When designing a bridge, an architect has al sorts of tools & techniques to verify it won't collapse.
Us software developers... We build. And with a bit of luck, we'll even test. And then we pray it doesn’t collapse :)
Can we measure software? Can we compare code objectively? Can we predict problems?
17. Engineered to match human analysis
Software metrics » Complexity
Maintainability index
18. Combination of:
• Cyclomatic complexity
• Halstead measures
• Lines of code
Software metrics » Complexity
Maintainability index
19. Metrics for matthiasmullie/minify, MatthiasMullieMinifyJS::stripWhitespace
See https://www.cauditor.org/matthiasmullie/minify/c17eb048daa44b43fa98bfa405147e77a040df76/metrics
Software metrics » Complexity
Maintainability index
30. High efferent coupling
= likely to be impacted by changes in
= other classes
= not stable
Software metrics » Coupling
Instability
31. Low afferent coupling
= change is easy because there isn’t much
= that depends on this
= not stable
Software metrics » Coupling
Instability
32. Stable = good
… as long as you don’t need to change
the implementation!
Software metrics » Coupling
Instability
33. Aim for extremes, make classes as stable
or unstable as possible!
Unstables can be refactored/decomposed
later. Better than having dependencies
everywhere.
Software metrics » Coupling
Instability
34. Counts # of ancestors
Software metrics » Coupling
Depth of inheritance
35. class Ancestor {}
DIT: 0
class Descendant1 extends Ancestor {}
DIT: 1
class Descendant2 extends Descendant1 {}
DIT: 2
Software metrics » Coupling
Depth of inheritance
36. Inheritance is not bad!
• Code reuse
• Polymorphism
Software metrics » Coupling
Depth of inheritance
37. But too much is!
• Less stable: change in ancestor can
affect descendants
• More complexity: methods of all
ancestors are inherited
Software metrics » Coupling
Depth of inheritance
58. • No change over time
• No change across projects
Do developers have a “signature”?
Software metrics » Observations
No evolution
59. Software metrics » Observations
Personalities?
2 guys working on same project:
• One was very fast (but messier)
• One was a lot more thorough
Who’s who?
62. Software metrics » Observations
Personalities?
Can metrics show personality traits?
Please help me figure that out!
https://www.cauditor.org/user/feedback