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

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.

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 31 users / day
  • 106 users / week
  • 580 users / month
  • 2.25K users / 6 months
  • 1 subscriber
  • 1.66K Posts
  • 36.8K Comments
  • Modlog