• Troy@lemmy.ca
    link
    fedilink
    arrow-up
    18
    arrow-down
    1
    ·
    11 months ago

    Tl;dr: don’t use @property during design, it’s almost certainly the wrong pattern. But use it to retrofit a method to a value.

    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      11 months ago

      Yup. I pretty much only use it if I need to ensure new values are valid or provide a default value.

      I do the same in other languages, like C# and JavaScript. Properties are cool, but should be quite rare.