Code Smell 15 - Missed Preconditions
15 October, 2022
0
0
0
Contributors
TD;DR: If you turn off your assertions just in production your phone will ring at late hours.
Problems
•
•
•
•
Solutions
•
•
•
•
Examples
•
Constructors are an excellent first line of defense
•
Anemic Objects lack these rules.
Sample Code
Wrong
Right
Detection
•
Tags
•
Conclusion
More info
Relations
Credits
Writing a class without its contract would be similar to producing an engineering component (electrical circuit, VLSI (Very Large Scale Integration) chip, bridge, engine…) without a spec. No professional engineer would even consider the idea.
programming
refactoring
cleancode
codesmell