Agile code quality metrics

10,603 views
9,921 views

Published on

A few KPIs for static code analysis for agile teams

Published in: Education

Agile code quality metrics

  1. 1. Agile Code Quality Metrics<br />Gil Nahmias, CSP<br />
  2. 2. Summary for Experts<br />Tools<br /><ul><li>‘Metrics’ eclipse plugin
  3. 3. Ndepend
  4. 4. SourceMonitor
  5. 5. Klocwork</li></ul>Metrics<br />WTF/Minute<br />Abstractness vs. Instability<br />Cyclomatic complexity<br />Test cases/Class<br />Defect Density<br />Fan in, Fan out<br />Code coverage, Test coverage<br />
  6. 6. “Metrics are a carving knife when what you really need is a scalpel. Metrics can tell you something is wrong, but they can't give you much guidance about the precise cause.<br />disclaimer<br />In the case of clean code, the cause is discipline and professionalism”...”Fixing that problem is a matter of instilling pride of workmanship into the team” <br /> -- Uncle Bob<br />
  7. 7. Note before we start<br />What are we trying to understand<br />What we actually measure<br />How does it make people behave<br />
  8. 8. Note before we start<br />What are we trying to understand<br />What we actually measure<br />Software Quality<br /># of bugs<br />How does it make people behave<br />Not record bugs<br />Hidden bugs, long stabilization, poor quality<br />
  9. 9. Note before we start<br />What are we trying to understand<br />What we actually measure<br />Software Quality<br />Escaping <br />Defects<br />How does it make people behave<br />Hidden bugs, long stabilization, poor quality<br />
  10. 10. WTF/Minute – in code review<br />osnews.com/comics<br />
  11. 11. Abstractness vs. instability<br />blog.troytuttle.com<br />
  12. 12. Software quality<br />Defect Density: number of defects per lines of code<br />Unit test density: number of unit test cases per feature or class.<br />+ve (actual = expected)<br /> -ve (actual != expected)<br /> stress<br /> integration<br />MINIMUM<br />4<br />
  13. 13. completeness<br />Code coverage: percentage of automatically tested code<br />Test coverage: percentage of automatically tested business scenarios<br />Tests<br />Code<br />Business<br />
  14. 14. complexity<br />Fan-in: per type is the number of types that depends directly on it. [a.k.a. Afferent Coupling]<br />Fan-out: per type is the number of types it directly depends on.  [a.k.a. Efferent Coupling]<br />Cyclomaticcomplexity: number of decisions that can be taken in a procedure<br /> [can be measured per class/feature]<br />
  15. 15. contact me for more<br />gil@agilesparks.com<br />@gilnahmias<br />myagile.co.il<br />

×