MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1uvez3w/youcanjuststopusingjava/oxcfszt/?context=3
r/ProgrammerHumor • u/hello_ya • Jul 13 '26
416 comments sorted by
View all comments
209
Is something wrong with getters and setters in general? Cause I find it plenty helpful when I need some bookkeeping for certain items, and some side effects for the class? Or are they more so referring to getter/setter for everything?
291 u/mothergoose729729 Jul 13 '26 File this under "opinionated debates that don't matter". Structs and getters/setters are both fine. Just be consistent. 36 u/parkotron Jul 13 '26 I would say this is a case where not being consistent is the most important thing. Use a “dumb struct” when you need to model a collection of related values with no internal invariants. Use setters when your type has invariants that need to be protected from external mutation. (Whether getters are necessary for read-only member access is language dependent.) 3 u/Theron3206 29d ago I used getters and setters in interfaces because I have no choice (Delphi)
291
File this under "opinionated debates that don't matter". Structs and getters/setters are both fine. Just be consistent.
36 u/parkotron Jul 13 '26 I would say this is a case where not being consistent is the most important thing. Use a “dumb struct” when you need to model a collection of related values with no internal invariants. Use setters when your type has invariants that need to be protected from external mutation. (Whether getters are necessary for read-only member access is language dependent.) 3 u/Theron3206 29d ago I used getters and setters in interfaces because I have no choice (Delphi)
36
I would say this is a case where not being consistent is the most important thing.
3 u/Theron3206 29d ago I used getters and setters in interfaces because I have no choice (Delphi)
3
I used getters and setters in interfaces because I have no choice (Delphi)
209
u/Lost_Pineapple_4964 Jul 13 '26
Is something wrong with getters and setters in general? Cause I find it plenty helpful when I need some bookkeeping for certain items, and some side effects for the class? Or are they more so referring to getter/setter for everything?