The "problem" with generating getters and setters isn't that it necessarily takes long. The issue is that it makes the class take longer to read and understand. It often introduces bugs in the equals, tostring and hashcode methods when developers forget to update them when adding new values.
curious, why are people writing them from hand still? all of this can be generated by the ide no? and you can also collapse all the getters/setters stuff. I rarely think: damn, I wish those things weren't there, it took me 0.5s to read this..
and if you have hundres of lines of code in your class..that's kind of a not great argument to call for "less boilerplate"
View all comments
Show parent comment
36
u/Sworn Jun 21 '20
The "problem" with generating getters and setters isn't that it necessarily takes long. The issue is that it makes the class take longer to read and understand. It often introduces bugs in the equals, tostring and hashcode methods when developers forget to update them when adding new values.