SlideShare una empresa de Scribd logo
1 de 31
The Dark Side of
 Code Metrics
Why do we care so much?
• Trying to qualify work completed
• Trying to predict future work
Lines of Code (LoC)
• Quantifying outstanding or completed
  work
• What is better, having fewer or more
  lines of code?
Lines of Code (LoC)
Lines of Code (LoC)
Lines of Code (LoC)
Lines of Code (LoC)
• 1000s of ways to write the same thing
• Context is king
• An estimating crutch for management
Amount of Comments
• Sometimes seen as LoC:LoComments ratio
• Driven by the belief that comments
  increase the understandability of code
Comments
Comments
Comments
Comments
Comments
Amount of Comments
•   A crutch for lazy coding
•   Misuse of existing systems
•   Creates a maintenance burden
•   Guaranteed to be incorrect
Code Coverage
• Executing code via automated tests
  increases the quality of the code
• %age of lines of code executed by
  automated tests
Code Coverage
1. Codebase has 85% coverage
2. Developer refactors some code and
   commits changes
3. Codebase has 82% coverage, build fails
   because threshold is 85%

            What went wrong?
Code Coverage
• Codebase has 100% coverage
• Developer makes daily releases to fix
  daily defect reports

          What’s the problem?
Code Coverage
• Class has 40 lines of code and 0%
  coverage
          What’s the problem?
Code Coverage
• Class has 5 lines of code and 0%
  coverage
Code Coverage
• Context is king
• Who decides the arbitrary “acceptable”
  %age?
• Who decides what code needs to be
  tested?
Maintainability Index
= MAX(0,(171 - 5.2 * log(Halstead Volume) -
 0.23 * (Cyclomatic Complexity) - 16.2 *
 log(Lines of Code))*100 / 171)

• Higher number means more maintainable
Maintainability Index
• What does it tell us though?
• Comparison of two codebases?
  – Only if they have very similar LoC and CC
    values
• Comparison of two modules?
• How hard it is to understand the code?
Maintainability Index
• With no peer comparison it is an arbitrary
  number
• What is an application’s peer though?
Generated Code
• Should metrics be applied?
• What does the metric mean?
• How easily can you exclude/separate?
The Lie
• Metrics offer emperical evidence about a
  codebase
• By themselves, metrics provide meaning
The Truth
• Metrics are nothing more than statistics
• Can be made to represent anything
• The numbers, by themselves, represent
  nothing
• Interpretation is in the eye of the
  beholder
The Light Side
• The output numbers mean nothing by
  themselves
• Look at interesting comparisons
  – Time based
  – Module based
  – Developer based
• Look for deltas rather than actuals
Deltas Over Time
• How did <metric> change
  – since last run?
  – since last release?
Related Metrics
• Code Coverage vs Defect Reports
• Defect Reports vs Code Churn
• Look at the deltas over a time period
Creating valuable meaning
   requires hard work
@dbelcham
donald.belcham@igloocoder.com

Más contenido relacionado

Destacado

Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrhTransparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
Hichem Chehida
 
Maersk Line's Agile Journey LESS 2012
Maersk Line's Agile Journey LESS 2012 Maersk Line's Agile Journey LESS 2012
Maersk Line's Agile Journey LESS 2012
OzlemYuce
 
Spec flow – functional testing made easy
Spec flow – functional testing made easySpec flow – functional testing made easy
Spec flow – functional testing made easy
Paul Stack
 

Destacado (20)

A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0
 
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrhTransparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
Transparent firewall filtering bridge - pf sense 2.0.2 by william tarrh
 
StarEast2013 - kanban for test teams
StarEast2013 - kanban for test teamsStarEast2013 - kanban for test teams
StarEast2013 - kanban for test teams
 
Introduction to kanban
Introduction to kanbanIntroduction to kanban
Introduction to kanban
 
How to Get Started with Kanban, and Why
How to Get Started with Kanban, and WhyHow to Get Started with Kanban, and Why
How to Get Started with Kanban, and Why
 
Maersk Line's Agile Journey LESS 2012
Maersk Line's Agile Journey LESS 2012 Maersk Line's Agile Journey LESS 2012
Maersk Line's Agile Journey LESS 2012
 
Combating entropy in business
Combating entropy in businessCombating entropy in business
Combating entropy in business
 
Mvvm basics
Mvvm basicsMvvm basics
Mvvm basics
 
Spec flow – functional testing made easy
Spec flow – functional testing made easySpec flow – functional testing made easy
Spec flow – functional testing made easy
 
Identifying and managing waste in software product development
Identifying and managing waste in software product developmentIdentifying and managing waste in software product development
Identifying and managing waste in software product development
 
Kanban 101 - 3 - Kanban Essentials
Kanban 101 - 3 - Kanban EssentialsKanban 101 - 3 - Kanban Essentials
Kanban 101 - 3 - Kanban Essentials
 
Seven Types Of Waste: Setting Priorities For Improvement Discussion
Seven Types Of Waste: Setting Priorities For Improvement DiscussionSeven Types Of Waste: Setting Priorities For Improvement Discussion
Seven Types Of Waste: Setting Priorities For Improvement Discussion
 
Scrum-ban in practice
Scrum-ban in practiceScrum-ban in practice
Scrum-ban in practice
 
Waste Elimination
Waste  EliminationWaste  Elimination
Waste Elimination
 
Kanban 101 - 1 - Perfection, Waste and Value Stream Mapping
Kanban 101 - 1 - Perfection, Waste and Value Stream MappingKanban 101 - 1 - Perfection, Waste and Value Stream Mapping
Kanban 101 - 1 - Perfection, Waste and Value Stream Mapping
 
Alternate Hourly Lean Introduction
Alternate Hourly Lean IntroductionAlternate Hourly Lean Introduction
Alternate Hourly Lean Introduction
 
Kanban Basics for Beginners
Kanban Basics for BeginnersKanban Basics for Beginners
Kanban Basics for Beginners
 
Using Erlang on the RaspberryPi to interact with the physical world
Using Erlang on the RaspberryPi to interact with the physical worldUsing Erlang on the RaspberryPi to interact with the physical world
Using Erlang on the RaspberryPi to interact with the physical world
 
Kanban VS Scrum
Kanban VS ScrumKanban VS Scrum
Kanban VS Scrum
 
Low Latency Mobile Messaging using MQTT
Low Latency Mobile Messaging using MQTTLow Latency Mobile Messaging using MQTT
Low Latency Mobile Messaging using MQTT
 

Similar a The Dark Side of Code Metrics

Quality metrics and angular js applications
Quality metrics and angular js applicationsQuality metrics and angular js applications
Quality metrics and angular js applications
nadeembtech
 
Slides for Houston iPhone Developers' Meetup (April 2012)
Slides for Houston iPhone Developers' Meetup (April 2012)Slides for Houston iPhone Developers' Meetup (April 2012)
Slides for Houston iPhone Developers' Meetup (April 2012)
lqi
 

Similar a The Dark Side of Code Metrics (20)

Quality metrics and angular js applications
Quality metrics and angular js applicationsQuality metrics and angular js applications
Quality metrics and angular js applications
 
Finding Defects in C#: Coverity vs. FxCop
Finding Defects in C#: Coverity vs. FxCopFinding Defects in C#: Coverity vs. FxCop
Finding Defects in C#: Coverity vs. FxCop
 
Software Coding- Software Coding
Software Coding- Software CodingSoftware Coding- Software Coding
Software Coding- Software Coding
 
Improving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis codeImproving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis code
 
Slides for Houston iPhone Developers' Meetup (April 2012)
Slides for Houston iPhone Developers' Meetup (April 2012)Slides for Houston iPhone Developers' Meetup (April 2012)
Slides for Houston iPhone Developers' Meetup (April 2012)
 
Technical debt management strategies
Technical debt management strategiesTechnical debt management strategies
Technical debt management strategies
 
Code coverage
Code coverageCode coverage
Code coverage
 
10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming
 
Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening
 
Code qualityCode qualityCode quality.pptx
Code qualityCode qualityCode quality.pptxCode qualityCode qualityCode quality.pptx
Code qualityCode qualityCode quality.pptx
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Полезные метрики покрытия. Практический опыт и немного теории
Полезные метрики покрытия. Практический опыт и немного теорииПолезные метрики покрытия. Практический опыт и немного теории
Полезные метрики покрытия. Практический опыт и немного теории
 
Design for Testability in Practice
Design for Testability in PracticeDesign for Testability in Practice
Design for Testability in Practice
 
Caring About Code Quality (Clean Code, GRASP, Effective Java, Design Pattern)
Caring About Code Quality (Clean Code, GRASP, Effective Java, Design Pattern)Caring About Code Quality (Clean Code, GRASP, Effective Java, Design Pattern)
Caring About Code Quality (Clean Code, GRASP, Effective Java, Design Pattern)
 
The Next Static Code Analysis Tool - Today and Tomorrow
The Next Static Code Analysis Tool - Today and TomorrowThe Next Static Code Analysis Tool - Today and Tomorrow
The Next Static Code Analysis Tool - Today and Tomorrow
 
Code Reviews
Code ReviewsCode Reviews
Code Reviews
 
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald BelchamGetting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
 
Enterprise Node - Code Quality
Enterprise Node - Code QualityEnterprise Node - Code Quality
Enterprise Node - Code Quality
 
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
 
Code Review
Code ReviewCode Review
Code Review
 

Más de Donald Belcham

Design patterns you didn't know about
Design patterns you didn't know aboutDesign patterns you didn't know about
Design patterns you didn't know about
Donald Belcham
 
Programming Closer to the Iron
Programming Closer to the IronProgramming Closer to the Iron
Programming Closer to the Iron
Donald Belcham
 
Taming Brownfield Codebases with AOP
Taming Brownfield Codebases with AOPTaming Brownfield Codebases with AOP
Taming Brownfield Codebases with AOP
Donald Belcham
 

Más de Donald Belcham (20)

Introduction to Messaging
Introduction to MessagingIntroduction to Messaging
Introduction to Messaging
 
Advanced messaging patterns
Advanced messaging patternsAdvanced messaging patterns
Advanced messaging patterns
 
Microservices: The Nitty Gritty
Microservices: The Nitty GrittyMicroservices: The Nitty Gritty
Microservices: The Nitty Gritty
 
Microservices: A Gentle Introduction
Microservices: A Gentle IntroductionMicroservices: A Gentle Introduction
Microservices: A Gentle Introduction
 
AOP & Patterns
AOP & PatternsAOP & Patterns
AOP & Patterns
 
Intro To AOP
Intro To AOPIntro To AOP
Intro To AOP
 
Source Control Abominations
Source Control AbominationsSource Control Abominations
Source Control Abominations
 
Is There Room for Craftsmanship in Software Development
Is There Room for Craftsmanship in Software DevelopmentIs There Room for Craftsmanship in Software Development
Is There Room for Craftsmanship in Software Development
 
Reducing External Risk
Reducing External RiskReducing External Risk
Reducing External Risk
 
Performance Tuning in the Trenches
Performance Tuning in the TrenchesPerformance Tuning in the Trenches
Performance Tuning in the Trenches
 
Reliability and Resilience
Reliability and ResilienceReliability and Resilience
Reliability and Resilience
 
Reliability and Reslience
Reliability and ReslienceReliability and Reslience
Reliability and Reslience
 
Introduction To AOP
Introduction To AOPIntroduction To AOP
Introduction To AOP
 
Design patterns you didn't know about
Design patterns you didn't know aboutDesign patterns you didn't know about
Design patterns you didn't know about
 
Programming Closer to the Iron
Programming Closer to the IronProgramming Closer to the Iron
Programming Closer to the Iron
 
Taming Brownfield Codebases with AOP
Taming Brownfield Codebases with AOPTaming Brownfield Codebases with AOP
Taming Brownfield Codebases with AOP
 
Domain Driven Design Primer
Domain Driven Design PrimerDomain Driven Design Primer
Domain Driven Design Primer
 
Hacking Hardware
Hacking HardwareHacking Hardware
Hacking Hardware
 
Advanced AOP
Advanced AOPAdvanced AOP
Advanced AOP
 
Continuous Deployment
Continuous DeploymentContinuous Deployment
Continuous Deployment
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

The Dark Side of Code Metrics

Notas del editor

  1. Heavy comments
  2. Content revealing code
  3. Out of sync