407
you are viewing a single comment's thread
view the rest of the comments
[-] CapeWearingAeroplane@sopuli.xyz 1 points 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.

this post was submitted on 30 May 2024
407 points (100.0% liked)

Programmer Humor

32742 readers
415 users here now

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

Rules:

founded 5 years ago
MODERATORS