• Miaou@jlai.lu
    link
    fedilink
    arrow-up
    1
    ·
    6 months ago

    Having to run a debugger to know what gets called at a given time is awful, and this oop practices exacerbate this

    • CapeWearingAeroplane@sopuli.xyz
      link
      fedilink
      arrow-up
      1
      ·
      6 months ago

      I am very fond of the idea of “stateless” code, which may seem strange coming from a person that likes OOP. When I say “stateless”, I am really referring to the fact that no class method should ever have any side-effect. Either it is an explicit set method, or it shouldn’t affect the output from other methods of the object. Objects should be used as convenient ways of storing/manipulating data in predictable/readable ways.

      I’ve seen way too much code where a class has methods which will only work"as expected" if certain other methods have been called first.