3 ms·
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
by eweise 9y 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.
- exception_e 9y agoTo be fair, most people use IDEs that generate them based on the fields so this would be unlikely.
- Someone 9y agoUnlikely, 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.
- lmm 9y agoUnlikely 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.
- eweise 9y agoI 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.