Trending Tags
    Trending Notes
    Global
    Trending Profiles

      Nostr View


      Silberengel @Laeserin - 1y

      Getters and setters, or nah? https://media.tenor.com/Pt-gRP6TeMoAAAAC/yes-im-old-school-cass-dekennessy.gif #devs

      undefined
      undefined
      undefined

      Silberengel @Laeserin - 1y

      The code I'm finding online never seem to use them. Have they gone out of style?

      undefined
      undefined
      undefined

      The Fishcake🐶🐾 & 763 others @The Fishcake🐶🐾 - 1y

      It depends if you need to perform validation and transformation. Also if you variables are private or not

      undefined
      undefined
      undefined

      Silberengel @Laeserin - 1y

      The thing is... I might, later, and I don't want to have to decide now, so my internal refactoring-hater is like, just make all class properties private and get/set everything and then it's the same everywhere and you can put the decision off. 😅

      undefined
      undefined
      undefined

      Silberengel @Laeserin - 1y

      I think I picked up the habit from working with Doctrine and Symfony. I think they they're strict about that.

      undefined
      undefined
      undefined

      Silberengel @Laeserin - 1y

      Just found this, in an article: "Non private attributes does not only allow to change the state from outside, there is also the possibility to update attribute values from classes that inherit."

      undefined
      undefined
      undefined

      Silberengel @Laeserin - 1y

      You mean, as you can access over the __construct() ?

      undefined
      undefined
      undefined

      Silberengel @Laeserin - 1y

      Hmm. I don't think PHP does that.

      undefined
      undefined
      undefined

      Showing page 1 of 1 pages