News for hackers. Stuff that matters.
Re:Getter-Setter Pattern Considered Harmful by Pxtl on Monday February 17, 2025 @11:26AM (#43080586)
To me that's just a matter of having standards that have clear requirements of what's okay to put in a getter - imho, refreshing invalidated caches (as long as they're lightweight and not like network communication) is perfectly appropriate. Anything with a side-effect that can be observed from outside of the object (creating the case where you get code just hitting setters and getters to cause side effects) is right out.

I mean, Lazy<T> is a great example of use of getters.

There are no comments on this comment yet.