agile code quality metrics

12
Agile Code Quality Metrics Gil Nahmias, CSP

Upload: gil-nahmias

Post on 22-Nov-2014

8.264 views

Category:

Education


0 download

DESCRIPTION

A few KPIs for static code analysis for agile teams

TRANSCRIPT

Page 1: Agile code quality metrics

Agile Code Quality Metrics

Gil Nahmias, CSP

Page 2: Agile code quality metrics

Summary for Experts

Metrics–WTF/Minute– Abstractness vs.

Instability– Cyclomatic complexity– Test cases/Class– Defect Density– Fan in, Fan out– Code coverage, Test

coverage

Tools- ‘Metrics’

eclipse plugin- Ndepend- SourceMonitor- Klocwork

Page 3: Agile code quality metrics

“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.

disclaimer

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”

-- Uncle Bob

Page 4: Agile code quality metrics

Note before we start

What are we trying to understand

What we actually measure How does it

make people behave

Page 5: Agile code quality metrics

Note before we start

What are we trying to understand

What we actually measure How does it

make people behave

Software Quality

# of bugs

Not record bugsHidden bugs, long stabilization, poor quality

Page 6: Agile code quality metrics

Note before we start

What are we trying to understand

What we actually measure How does it

make people behave

Software Quality

Escaping Defects

Hidden bugs, long stabilization, poor quality

Page 7: Agile code quality metrics

WTF/Minute – in code review

osnews.com/

comics

Page 8: Agile code quality metrics

Abstractness vs. instability

blog.troytuttle.co

m

Page 9: Agile code quality metrics

Software quality

Defect Density: number of defects per lines of code

Unit test density: number of unit test cases per feature or class.

+ve (actual = expected) -ve (actual != expected) stress

integration

MINIMUM

4

Page 10: Agile code quality metrics

completeness

Code coverage: percentage of automatically tested code

Test coverage: percentage of automatically tested business scenarios

Code

Tests

Business

Page 11: Agile code quality metrics

complexity

Fan-in: per type is the number of types that depends directly on it. [a.k.a. Afferent Coupling]

Fan-out: per type is the number of types it directly depends on.  [a.k.a. Efferent Coupling]

Cyclomatic complexity: number of decisions that can be taken in a procedure [can be measured per class/feature]

Page 12: Agile code quality metrics

contact me for more

[email protected]

@gilnahmias

myagile.co.il