Hacker News new | ask | show | jobs
by eweise 3157 days ago
Exactly which is why no one is going to look at all those getters and setters you added not realizing that one of the setters actually does something other than setting the field or a getter causes some side effect before returning the value.
1 comments

To be fair, most people use IDEs that generate them based on the fields so this would be unlikely.
Unlikely, but to be sure, you have to read all the boilerplate, attentively.

If your language generates them behind the scenes, so that nobody can modify them, that doesn’t happen.

Also, if a developer overrides one particular example, it stands out in the source, as it (ideally) is the only code visible in the source.

Unlikely edge cases are the biggest source of bugs. One of the worst production bugs I've seen happened because someone refactored some code assuming a getter just got the field, like 99.9% of getters do, but this particular getter didn't.
I think you miss my point. Most people DO generate them via an IDE so they don't get looked at closely. But imagine someone then editing one of the generated methods to do something different than expected. Happens all the time.