![cover-img](https://project-assets.showwcase.com/1420x/16381/1669158980567-victor-rodriguez-IiLFMkqiFrM-unsplash.jpg?type=webp)
Code Smell 28 - Setters
22 November, 2022
4
4
0
Contributors
Problems
•
Mutability
•
Information Hiding
•
Anemic Models
•
Fail Fast
•
Integrity
•
Duplicated Code
Solutions
1.
Avoid Setters
2.
Set essential attributes on private initialization.
Examples
•
Sample Code
Wrong
Right
Detection
Exceptions
Tags
•
Mutation
•
Information Hiding
Conclusion
Relations
More Info
Credits
Object-oriented programming languages support encapsulation, thereby improving the ability of software to be reused, refined, tested, maintained, and extended. The full benefit of this support can only be realized if encapsulation is maximized during the design process.