![cover-img](https://project-assets.showwcase.com/1420x/16381/1668901137373-nick-van-den-berg-2vb-_3t6YCM-unsplash.jpg?type=webp)
Code Smell 26 - Exceptions Polluting
19 November, 2022
4
4
0
Contributors
TL;DR; Don't create anemic and empty objects. Even if they are Exceptions.
Problems
•
Over Design
•
Namespace Pollution
Solutions
1.
Avoid creating anemic exceptions as globals.
2.
Create exceptions only if they behave differently.
3.
Model exceptions with objects. Classes are handy for lazy programmers.
Sample Code
Wrong
Right
Detection
Tags
•
Abuser
•
Naming
Conclusion
Relations
Credits
You will fall to ruin because you believe that exceptions to the rule make new rules.