Stop Making Private Variables feat. BadCop | 058

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024

Комментарии • 45

  • @_DATA_EXPUNGED_
    @_DATA_EXPUNGED_ 3 месяца назад +14

    Yay, Sarah is such a fantastic guest. Always super interesting to listen into anything she's on :)

    • @Go_with-Christ
      @Go_with-Christ 3 месяца назад +3

      thats a woman?

    • @_DATA_EXPUNGED_
      @_DATA_EXPUNGED_ 3 месяца назад +6

      ​@@Go_with-Christ That's neither your nor my business. Please go somewhere else with your sealioning, this podcast is about programming not your triggered rants.

    • @jeffreysmith9837
      @jeffreysmith9837 3 месяца назад +1

      he

    • @TheKennyWorld
      @TheKennyWorld 10 дней назад

      Fair question.

  • @VoyivodaFTW1
    @VoyivodaFTW1 3 месяца назад +5

    Intimidatingly correct means that you were just pragmatic. Normies hate it when you're pragmatic.

  • @AloisMahdal
    @AloisMahdal 3 месяца назад +8

    0 is called exit code; the idea is that there's only one way to succeed, but many ways to fail. there's nothing wrong with that. (and yes you can just do "if that_thing".)

    • @justin_ooo
      @justin_ooo 2 месяца назад

      interesting, from the perspective of how bash was designed it'd still be preferable for 1 and 0 to be switched (success/failure)

  • @transcendtient
    @transcendtient 3 месяца назад +5

    Don't tell me how to protect me from me.

    • @ar_xiv
      @ar_xiv 3 месяца назад

      bingo

  • @justin_ooo
    @justin_ooo 2 месяца назад +1

    I was a lil disappointed at 44:24 when Sarah said she isn't a big fan of encapsulation. if done correctly it can make code more modular and maintainable, and being private/public isn't the only thing it's about. it can definitely improve readability too. the problem is too many people don't know when and how to apply it in an effective way. it's a great thing if applied well, and a pain if not.

  • @aDaily1222
    @aDaily1222 3 месяца назад +3

    great interview.
    glad to see badcop once again

  • @realdebil.
    @realdebil. 3 месяца назад +1

    public fields are okay only if the value under that field does not have to uphold to some property at all times, otherwise getters and setters are almost an necessity, or one would have to put "assert(property(this.x));" at the beginning of every function that uses "x"

  • @DevanConrad
    @DevanConrad Месяц назад

    Yep all the Clean Code stuff is about a mythical platonic abstract realm where anything can be swapped for anything as long as you add 9 layers of boilerplate indirection. I'm struggling to get myself coworkers to not write bugs everywhere even without ivory tower type hierarchies.

  • @caseyknolla8419
    @caseyknolla8419 Месяц назад

    I went the self-built NAS route first, but also made the same decision that I want storage to just work because it's the part of my homelab that I want to be the most stable. I also wanted to be able to gradually add drives over time, and Synology handles that very well.

  • @Burgo361
    @Burgo361 3 месяца назад +1

    I think have to get past the gatekeepers back in the day made me think more before I asked a question, but it did also make me question if it was worth it. Though if someone is going out of their way to help me on their own time I can tolerate quite a lot of rudeness.

  • @davel202
    @davel202 3 месяца назад +2

    This is my private variable I don’t know you!

  • @ar_xiv
    @ar_xiv 3 месяца назад +1

    I find encapsulation in specifically video game development libraries extremely annoying. It's like the library author is trying to come up with this perfect way for you to set up and use their functions, with everything being represented as different objects or whatever. It's all well and good until you need something that the class isn't representing, then you basically have to throw it all out start from scratch in the worst case, or fork their library and make a bunch of stuff public just so you can get this one thing buried in the hierarchy out of it. I'm like... get this enterprise bullshit out of my video game code, man.

    • @TheKennyWorld
      @TheKennyWorld 10 дней назад

      Probably a dumb question but can't you just use reflection?

    • @ar_xiv
      @ar_xiv 10 дней назад +1

      @@TheKennyWorld reflection is slow and I consider it a hack in most cases, but it’s probably a solution if you’re in a bind. It’s probably fast enough for loading but too slow for gameplay. I’m just personally trying to move past situations where I have to come up with something crazy just to work around an API

  • @freezingcicada6852
    @freezingcicada6852 3 месяца назад +5

    Global variable bad. Therefore I will jump through hoops to access a variable that has a life time of the app

    • @SimGunther
      @SimGunther 3 месяца назад

      Sounds like a global context needs to be passed around all throughout the program?

    • @backendbanterfm
      @backendbanterfm  3 месяца назад +3

      dEsIGn PaTTeRns

    • @elijahbuscho7715
      @elijahbuscho7715 3 месяца назад

      It's so much harder to keep track of how the data is used within the application when it's a global variable. You literally have to look at every file in your codebase. And when you don't know how your data is being used, it's harder to refactor. And when it's harder to refactor, it's easier for your codebase to degenerate.
      I like grouping related functions into singleton classes, and any would be global state gets passed into the constructor and stored as a private instance variable. This makes it super easy to know which data is used for any function. You just need to look at one place and you know everywhere the data is used.

  • @Set_Abominae
    @Set_Abominae 3 месяца назад +2

    Badcop looks absolutely not bad at all... I like her!

  • @vessbakalov8958
    @vessbakalov8958 4 дня назад

    Ok... That is not hacking.

  • @gwaptiva
    @gwaptiva 3 месяца назад +5

    You thinking something as "silly" doesn't disqualify it.

    • @backendbanterfm
      @backendbanterfm  3 месяца назад +1

      Many are saying this

    • @gwaptiva
      @gwaptiva 3 месяца назад +1

      @@backendbanterfm Having getters and setters to private field should be considered as part of the documentation. If you have read only fields, not providing a setter is _the_ documentation. If it is protected, that again is documentation. You cannot achieve this by making fields pubic.

    • @pookiepats
      @pookiepats 3 месяца назад

      @@gwaptiva too idealistic but i think i agree with the premise

    • @tah3460
      @tah3460 3 месяца назад +1

      ​@@gwaptivaPlease don't make fields pubic.

    • @bootdotdev
      @bootdotdev 3 месяца назад

      @@backendbanterfm And yet no one is saying this

  • @donaldstrubler3870
    @donaldstrubler3870 3 месяца назад

    It's weird to be against classes for Python....

    • @backendbanterfm
      @backendbanterfm  3 месяца назад +1

      not if you're just against classes!

    • @jeffreysmith9837
      @jeffreysmith9837 3 месяца назад

      But pointer receiver struct methods are ok? It's the same thing

  • @SnowDaemon
    @SnowDaemon 3 месяца назад +1

    👍

  • @4v4
    @4v4 Месяц назад

    sorry, is this a man or woman. i'm not trolling, genuine question

  • @SU3D3
    @SU3D3 3 месяца назад +1

    R0N1N are the protectors of #secrets 🕯