Code Smell 20 - Premature Optimization
28 October, 2022
1
1
0
Contributors
TL;DR: Don't guess things that might not happen.
Problems
•
Coupling
•
Testability
•
Readability
Solutions
1.
Create great models and bijections first.
2.
Create a conclusive benchmark once the model is working.
3.
Programmers waste enormous amounts of time worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. Donald Knuth
5.
Use Test Driven Development technique. It always favors the simplest solution.
Examples
•
Weird data structures
•
Caches
•
Singletons
Sample Code
Wrong
Right
Detection
Tags
•
Premature Optimization
•
Antipattern
Conclusion
Relations
More info
Credits
Premature optimization is the root of all evil.