SlideShare a Scribd company logo
IMPORTANT METRICS
@mscottford
BY M. SCOTT FORD

CO-FOUNDER & CHIEF CODE WHISPERER, CORGIBYTES
FOR MEASURING CODE HEALTH
@mscottford
@mscottford
METRICS YOUR DOCTOR USES
@mscottford
AGE?
METRICS YOUR DOCTOR USES
@mscottford
AGE?
WEIGHT?
METRICS YOUR DOCTOR USES
@mscottford
AGE?
WEIGHT?
HEIGHT?
METRICS YOUR DOCTOR USES
@mscottford
AGE?
WEIGHT?
HEIGHT?
METRICS YOUR DOCTOR USES
TEMPERATURE?
@mscottford
AGE?
WEIGHT?
HEIGHT?
BLOOD O2 LEVEL?
METRICS YOUR DOCTOR USES
TEMPERATURE?
@mscottford
AGE?
WEIGHT?
HEIGHT?
BLOOD O2 LEVEL?
METRICS YOUR DOCTOR USES
TEMPERATURE?
BLOOD PRESSURE?
@mscottford
AGE?
WEIGHT?
HEIGHT?
BLOOD O2 LEVEL?
ALL OF THESE ARE USED TOGETHER
TEMPERATURE?
BLOOD PRESSURE?
@mscottford
AGE?
WEIGHT?
HEIGHT?
BLOOD O2 LEVEL?
TOGETHER THEY PROVIDE SOME HINTS
TEMPERATURE?
BLOOD PRESSURE?
ABOUT ME
@mscottford
@mscottford
CHIEF CODE WHISPERER
CO-FOUNDER AND
@mscottford
WE PERFORM CODE INSPECTIONS
@mscottford
WE’VE LOOKED AT A LOT OF PROJECTS
WHAT METRICS DO WE LOOK AT?
@mscottford
@mscottford
???
???
???
@mscottford
???
???
CHURN
@mscottford
CHURN
A measure of how many
times file has changed
over a specific amount of
time
@mscottford
LIFETIME CHURN
A measure of how many
times file has changed
over the life of a project
@mscottford
RECENT CHURN
A measure of how many
times file has changed
during the last 3 months
@mscottford
???
???
CHURN
@mscottford
???
CODE COVERAGE
CHURN
@mscottford
CODE COVERAGE
A measure of how much of
the application is executed
when a test is performed
@mscottford
ACCEPTANCE TEST
CODE COVERAGE
A measure of how much of
the application is executed
when the acceptance tests
are run
@mscottford
INTEGRATION TEST
CODE COVERAGE
A measure of how much of
the application is executed
when the integration tests
are run
@mscottford
UNIT TEST
CODE COVERAGE
A measure of how much of
the application is executed
when the unit tests are run
@mscottford
???
CODE COVERAGE
CHURN
@mscottford
COMPLEXITY
CODE COVERAGE
CHURN
@mscottford
COMPLEXITY
A measure of how difficult
a chunk of code is to work
with
@mscottford
A measure of unique code
paths for a block of code
CYCLOMATIC
COMPLEXITY
@mscottford
A measure of the cognitive
effort required to
understand a block of code
COGNITIVE
COMPLEXITY
@mscottford
HOW DO WE COLLECT THESE METRICS?
CHURN
• git-churn script by Corey Haines & Gary Bernhardt
• https://github.com/garybernhardt/dotfiles/blob/master/bin/git-
churn
@mscottford
CODE COVERAGE
• Run tests with code coverage collection tool
• These vary by language
•Ruby: simplecov, rcov
•Python: coverage.py
• C#/.NET: dotCover, NCover, OpenCover
•Java: Clover, JCov, JCoCo, OpenClover, Cobertura,
•JavaScript: Istanbul, Jest
@mscottford
COMPLEXITY
• Run a static analysis tool to collect the data
• These also vary by language
• Ruby: rubocop, flog
• Python: radon
• C#/.NET: MS Visual Studio, NDepend, ReSharper,
SonarQube
• Java: PMD, GMetrics, IntelliJ, SonarQube,
• JavaScript: ESLint, JSHint, ccmj
@mscottford
WHY THESE METRICS?
@mscottford
@mscottford
CHURN
Code that has changed in
the past is more likely to
change in the future.
A good stand-in for single
responsibility principle.
@mscottford
CODE COVERAGE
Code that is tested is safer
to change.
@mscottford
COMPLEXITY
The more complex code is
the more dangerous to
change.
@mscottford
WHAT ARE ‘GOOD’ METRIC VALUES?
@mscottford
CHURN
Low is better. High is not
bad, but outliers are.
Recent churn is more
important than lifetime
churn.
@mscottford
CODE COVERAGE
100% across the entire
codebase is asymptotic.
85% is a reasonable target.
Unit > Integration >
Acceptance
@mscottford
COMPLEXITY
Provides best info at
method level:
1 - 5 : Good
6 - 10 : Complex
> 10 : Extremely Complex
@mscottford
USING THESE METRICS TOGETHER
@mscottford
@mscottford
LET’S EXPLORE COMMON SCENARIOS
@mscottford
@mscottford
COMPLEXITY
CODE COVERAGE
CHURN
HEALTHY
@mscottford
COMPLEXITY LOW
CODE COVERAGE HIGH
CHURN LOW
HEALTHY
@mscottford
COMPLEXITY
CODE COVERAGE
CHURN
DESIGN SMELL
@mscottford
COMPLEXITY LOW
CODE COVERAGE HIGH
CHURN HIGH
DESIGN SMELL
@mscottford
COMPLEXITY
CODE COVERAGE
CHURN
TESTING NOT A FOCUS
@mscottford
COMPLEXITY LOW
CODE COVERAGE LOW
CHURN LOW
TESTING NOT A FOCUS
@mscottford
COMPLEXITY
CODE COVERAGE
CHURN
REFACTORING NOT A FOCUS
@mscottford
COMPLEXITY HIGH
CODE COVERAGE HIGH
CHURN LOW
REFACTORING NOT A FOCUS
@mscottford
COMPLEXITY
CODE COVERAGE
CHURN
UNHEALTHY: LOW PRIORITY
@mscottford
COMPLEXITY HIGH
CODE COVERAGE LOW
CHURN LOW
UNHEALTHY: LOW PRIORITY
@mscottford
COMPLEXITY
CODE COVERAGE
CHURN
UNHEALTHY: HIGH PRIORITY
@mscottford
COMPLEXITY HIGH
CODE COVERAGE LOW
CHURN HIGH
UNHEALTHY: HIGH PRIORITY
@mscottford
QUESTIONS?
@mscottford
CONTACT INFO
@mscottford
@corgibytes
corgibytes.com
LegacyCode.Rocks

More Related Content

PDF
Top Business Competitions in Bangladesh
PPTX
Price determination and simple applications
PPTX
Case study of oligopoly on automobile industry
PDF
22061600 reliance-marketing-project
PPTX
G.D.P. Trends in India
PPTX
Forms of markets
DOCX
Poverty project
PDF
Class 12th IP project on buisness management
Top Business Competitions in Bangladesh
Price determination and simple applications
Case study of oligopoly on automobile industry
22061600 reliance-marketing-project
G.D.P. Trends in India
Forms of markets
Poverty project
Class 12th IP project on buisness management

Similar to Important metrics for Measuring Code Health (20)

PDF
Measuring Your Code
PDF
Software quality metrics
PPTX
Ch-3 for software Maintenance Measurement.pptx
PDF
Measuring Your Code
PDF
Measuring Your Code 2.0
DOCX
Algorithm ExampleFor the following taskUse the random module .docx
PDF
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
PPTX
Code metrics
PPTX
Code metrics
PPTX
OOAD - Ch.09 - Software Project Estimation.pptx
PDF
Sw metrics for regression testing
PDF
Containing Quality
PDF
Fuzzy Rule Base System for Software Classification
PPT
Software Product Measurement and Analysis in a Continuous Integration Environ...
PDF
Software metrics
PDF
Transitioning to quality software
PPT
Metrics
ODP
Software Measurement: Lecture 1. Measures and Metrics
PPTX
Software_Engineering_Metrics_and_Project_Management.pptx
PDF
IJSRED-V2I4P8
Measuring Your Code
Software quality metrics
Ch-3 for software Maintenance Measurement.pptx
Measuring Your Code
Measuring Your Code 2.0
Algorithm ExampleFor the following taskUse the random module .docx
EFFECTIVE IMPLEMENTATION OF AGILE PRACTICES – OBJECT ORIENTED METRICS TOOL TO...
Code metrics
Code metrics
OOAD - Ch.09 - Software Project Estimation.pptx
Sw metrics for regression testing
Containing Quality
Fuzzy Rule Base System for Software Classification
Software Product Measurement and Analysis in a Continuous Integration Environ...
Software metrics
Transitioning to quality software
Metrics
Software Measurement: Lecture 1. Measures and Metrics
Software_Engineering_Metrics_and_Project_Management.pptx
IJSRED-V2I4P8
Ad

More from M. Scott Ford (11)

PPTX
Lessons Learned Migrating from Jekyll to Next.pptx
PDF
PyGeekle 2022 - A Deep Dive into Measuring Dependency Freshness with LibYear
PDF
Communication is Just as Important as Code
PDF
MenderCon 2021 - Keynote
PDF
Moving a Monolith to Kubernetes
PDF
MenderCon 2020 Keynote Presentation
PDF
Makers and menders - Finding Talent for Legacy Code Projects
PDF
A deep dive into measuring dependency freshness with lib year
PDF
Building a Bridge to a Legacy Application: How Hard Can That Be?
PDF
Embracing the Red Bar: A Technique for Safely Refactoring Your Test Suite
PDF
Old Code, New Tricks
Lessons Learned Migrating from Jekyll to Next.pptx
PyGeekle 2022 - A Deep Dive into Measuring Dependency Freshness with LibYear
Communication is Just as Important as Code
MenderCon 2021 - Keynote
Moving a Monolith to Kubernetes
MenderCon 2020 Keynote Presentation
Makers and menders - Finding Talent for Legacy Code Projects
A deep dive into measuring dependency freshness with lib year
Building a Bridge to a Legacy Application: How Hard Can That Be?
Embracing the Red Bar: A Technique for Safely Refactoring Your Test Suite
Old Code, New Tricks
Ad

Recently uploaded (20)

PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
history of c programming in notes for students .pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Online Work Permit System for Fast Permit Processing
PDF
top salesforce developer skills in 2025.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Transform Your Business with a Software ERP System
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Introduction to Artificial Intelligence
PDF
Digital Strategies for Manufacturing Companies
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPT
Introduction Database Management System for Course Database
PDF
medical staffing services at VALiNTRY
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
System and Network Administration Chapter 2
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
history of c programming in notes for students .pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Online Work Permit System for Fast Permit Processing
top salesforce developer skills in 2025.pdf
Odoo POS Development Services by CandidRoot Solutions
Navsoft: AI-Powered Business Solutions & Custom Software Development
Transform Your Business with a Software ERP System
Which alternative to Crystal Reports is best for small or large businesses.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
How to Choose the Right IT Partner for Your Business in Malaysia
How to Migrate SBCGlobal Email to Yahoo Easily
Introduction to Artificial Intelligence
Digital Strategies for Manufacturing Companies
VVF-Customer-Presentation2025-Ver1.9.pptx
Introduction Database Management System for Course Database
medical staffing services at VALiNTRY
CHAPTER 2 - PM Management and IT Context
System and Network Administration Chapter 2

Important metrics for Measuring Code Health