cost of complexity
Complex code is...
- Harder to read
- Harder to test
- Harder to debug
Your code has at least one junk drawer
( probably several )
"[a system] must be continually adapted or it becomes progressively less satisfactory."
"As [a system] evolves its complexity increases unless work is done to maintain or reduce it."http://en.wikipedia.org/wiki/Lehman's_laws_of_software_evolution
or reduce [complexity]."
- Version control
- Automated testing
- Code Reviews
- Defines measurable properties as formulas
- They build on each other to describe relationships
- Not all of these measure complexity
- Some worth mentioning:
- Effort = Difficulty * Volume
- Estimated Bugs = Volume / 3000
- Based only on control flow
- Measures unique paths
- Gives an ideal number of tests
- Aggregate of several other metrics
- Scale from -Infinity to 171 (higher is better)
- Two variants
of this talk in website form. "
- me, just now
The wrap up
Use what helps; ignore the rest
Complexity Metrics and You
By Jared Stilwell