6 Matching Annotations
- Feb 2021
Stating that some language feature or common programming idiom (like accessors) has problems is not the same thing as saying you should never use them under any circumstances.
Though getter/setter methods are commonplace in Java, they are not particularly object oriented (OO). In fact, they can damage your code's maintainability. Moreover, the presence of numerous getter and setter methods is a red flag that the program isn't necessarily well designed from an OO perspective.
This article explains why you shouldn't use getters and setters (and when you can use them) and suggests a design methodology that will help you break out of the getter/setter mentality.
- to read
- object-oriented programming
- excellent technical writing
- the specific context is important
- programming idiom
- learning new way of thinking about something / overcoming habits/patterns/paradigms you are accustomed to
- software design
- Oct 2020