103
Debugging (lemmy.ml)
you are viewing a single comment's thread
view the rest of the comments
[-] yogthos@lemmy.ml 7 points 2 days ago

I find setters/getters are generally an antipattern because they obfuscate behavior. When you access a field you know what it looks like, but if you pass it through some implicit transformation in a getter then you have to know what that was.

[-] TheDoctor@hexbear.net 4 points 2 days ago

Yeah. I can understand the use case when it’s something relating to keeping simple state in sync by replacing it with derived state. But this particular case was flushing a cache after each get, which made each get of the property non-deterministic based on the class’s state.

[-] yogthos@lemmy.ml 5 points 2 days ago

lol yeah that sounds like a nightmare

this post was submitted on 04 Nov 2024
103 points (95.6% liked)

Programmer Humor

32380 readers
1338 users here now

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

Rules:

founded 5 years ago
MODERATORS