SlideShare a Scribd company logo
1 of 30
Download to read offline
Rails software metrics
     Roderick van Domburg
        Nedforce COO




     http://www.nedforce.nl
Roderick van Domburg
Lines of code
  Using stock Rails
rake stats
Occam’s Razor

Of two equivalent theories or explanations,
all other things being equal, the simpler one
is to be preferred.
Wikipedia, 6 June 2008
Comparative quality
                Mephisto 0.8   Typo 5.0.3

Lines of code      3694          6178

Test lines of
                    211          3298
   code
Code to test       1:0.1         1:0.5
   ratio
Code to test ratio
         Low       Medium          High

Ratio   < 1:0.8   1:0.8 - 1:1.5   ≥ 1:1.5
Cost estimation

       1.000
   Average lines of code
      per developer
         per year
Cost estimation

Can’t estimate lines of code
 based on requirements!
 Fenton & Pfleeger (1997)
Line test coverage
     Using rcov gem
Line coverage

• Formally: C0 coverage
• Lines of code that ran during tests
• Using rcov gem and rails_rcov plugin
rake test:units:rcov
Comparative quality
                Mephisto 0.8   Typo 5.0.3

Lines of code      3694          6178

Test lines of
                    211          3298
   code
 Line test         34.5%        83.3%
 coverage
71,4% coverage
def is_odd?(number)
 if number % 2 == 0
   return true
 else
   return false
 end
end
assert is_odd?(2)
100% coverage

def is_odd?(number)
 number % 2 == 0
end
assert is_odd?(2)
Branch test coverage
      Using heckle gem
Line coverage

• Formally: C1 coverage
• Possible branches that ran during tests
• Using heckle gem
Original
def is_odd?(number)
 if number % 2 == 0
   return true
 else
   return false
 end
end
assert is_foo?(2)
Mutation 1
def is_odd?(number)
 if number % 2 == 0
   return false
 else
   return true
 end
end
assert is_foo?(2)
Mutation 2
def is_odd?(number)
 if nil % 2 == 0
   return true
 else
   return false
 end
end
assert is_foo?(2)
Code complexity
    Using flog gem
test.rb
class Test
  def blah
   a = eval “1+1”
   if a == 2
     puts “yay”
   end
  end
end
flog test.rb
Test#blah: (11.2)
     6.0: eval
     1.2: branch
     1.2: ==
     1.2: puts
     1.2: assignment
     0.4: lit_fixnum
Comparative quality
             Mephisto 0.8   Typo 5.0.3

article.rb       325           574

 tag.rb          97            67

 user.rb         124           81
Cyclomatic complexity
      Using saikuro gem
Cyclomatic complexity

• Academic, formal
• Loosely: the number of statements that can
  not be expressed as simple flow structures
  (e.g. if, else, while)
Comparative quality
             Mephisto 0.8   Typo 5.0.3

article.rb       67            124

 tag.rb          17            16

 user.rb         25            24
flog vs. saikuro

• Cyclometic complexity is disputed
• Flog is not academically proven
• Flog has better Ruby understanding
Tracking over time

• Snapshot metrics not very useful
• Comparisons very difficult
• Tracking over time spots problems
• Use CruiseControl.rb plus metric_fu
Questions


http://www.nedforce.nl

More Related Content

Viewers also liked

Viewers also liked (19)

[SlideShare] The Blueprint to B2B Content Metrics
[SlideShare] The Blueprint to B2B Content Metrics[SlideShare] The Blueprint to B2B Content Metrics
[SlideShare] The Blueprint to B2B Content Metrics
 
14 software technical_metrics
14 software technical_metrics14 software technical_metrics
14 software technical_metrics
 
AWS운영을 위한 글로벌 관리 전략 - 베스핀 글로벌 김성수 상무:: AWS Cloud Track 2 Advanced
AWS운영을 위한 글로벌 관리 전략 - 베스핀 글로벌 김성수 상무:: AWS Cloud Track 2 AdvancedAWS운영을 위한 글로벌 관리 전략 - 베스핀 글로벌 김성수 상무:: AWS Cloud Track 2 Advanced
AWS운영을 위한 글로벌 관리 전략 - 베스핀 글로벌 김성수 상무:: AWS Cloud Track 2 Advanced
 
Purdue GIS Day 2015 - Ideation Workshop
Purdue GIS Day 2015 - Ideation WorkshopPurdue GIS Day 2015 - Ideation Workshop
Purdue GIS Day 2015 - Ideation Workshop
 
Connect Faster with SnapLogic at Workday Rising
Connect Faster with SnapLogic at Workday RisingConnect Faster with SnapLogic at Workday Rising
Connect Faster with SnapLogic at Workday Rising
 
Cloud Management with vRealize Operations
Cloud Management with vRealize OperationsCloud Management with vRealize Operations
Cloud Management with vRealize Operations
 
Subscribed 2015: Architecture, Security, Scalability
Subscribed 2015: Architecture, Security, ScalabilitySubscribed 2015: Architecture, Security, Scalability
Subscribed 2015: Architecture, Security, Scalability
 
Chapter 07 - Routing Dynamically
Chapter 07 - Routing DynamicallyChapter 07 - Routing Dynamically
Chapter 07 - Routing Dynamically
 
Application Performance Monitoring
Application Performance MonitoringApplication Performance Monitoring
Application Performance Monitoring
 
VMware Ready vRealize Automation Program
VMware Ready vRealize Automation ProgramVMware Ready vRealize Automation Program
VMware Ready vRealize Automation Program
 
Slides chapter 1
Slides chapter 1Slides chapter 1
Slides chapter 1
 
IBM Design Thinking - nano - Workshop @Sprint Collaboration Day
 IBM Design Thinking - nano - Workshop  @Sprint Collaboration Day IBM Design Thinking - nano - Workshop  @Sprint Collaboration Day
IBM Design Thinking - nano - Workshop @Sprint Collaboration Day
 
What is Application Performance Management?
What is Application Performance Management?What is Application Performance Management?
What is Application Performance Management?
 
IBM Design Thinking - Delievery Value at Scale
IBM Design Thinking - Delievery Value at ScaleIBM Design Thinking - Delievery Value at Scale
IBM Design Thinking - Delievery Value at Scale
 
Product metrics
Product metricsProduct metrics
Product metrics
 
Marketing Consulting Presentation
Marketing Consulting PresentationMarketing Consulting Presentation
Marketing Consulting Presentation
 
IBM Design: Design at Scale
IBM Design: Design at ScaleIBM Design: Design at Scale
IBM Design: Design at Scale
 
IBM Design Thinking Case Story
IBM Design Thinking Case StoryIBM Design Thinking Case Story
IBM Design Thinking Case Story
 
Consulting: the engagement lifecycle & core consultancy skills
Consulting: the engagement lifecycle & core consultancy skillsConsulting: the engagement lifecycle & core consultancy skills
Consulting: the engagement lifecycle & core consultancy skills
 

Similar to Rails Software Metrics

Qat09 presentations dxw07u
Qat09 presentations dxw07uQat09 presentations dxw07u
Qat09 presentations dxw07u
Shubham Sharma
 
CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019
Olivera Milenkovic
 
Automated Test Suite Generation for Time-Continuous Simulink Models
Automated Test Suite Generation for Time-Continuous Simulink ModelsAutomated Test Suite Generation for Time-Continuous Simulink Models
Automated Test Suite Generation for Time-Continuous Simulink Models
Lionel Briand
 

Similar to Rails Software Metrics (20)

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
 
Not your fathers language c++
Not your fathers language c++Not your fathers language c++
Not your fathers language c++
 
PHP Forum Paris 2012: Magic behind the numbers. Software metrics in practice
PHP Forum Paris 2012: Magic behind the numbers. Software metrics in practicePHP Forum Paris 2012: Magic behind the numbers. Software metrics in practice
PHP Forum Paris 2012: Magic behind the numbers. Software metrics in practice
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 
Speedy TDD with Rails
Speedy TDD with RailsSpeedy TDD with Rails
Speedy TDD with Rails
 
SREcon americas 2019 - Latency SLOs Done Right
SREcon americas 2019 - Latency SLOs Done RightSREcon americas 2019 - Latency SLOs Done Right
SREcon americas 2019 - Latency SLOs Done Right
 
Qat09 presentations dxw07u
Qat09 presentations dxw07uQat09 presentations dxw07u
Qat09 presentations dxw07u
 
So You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkSo You Want To Write Your Own Benchmark
So You Want To Write Your Own Benchmark
 
Measuring maintainability; software metrics explained
Measuring maintainability; software metrics explainedMeasuring maintainability; software metrics explained
Measuring maintainability; software metrics explained
 
Magic behind the numbers - software metrics in practice
Magic behind the numbers - software metrics in practiceMagic behind the numbers - software metrics in practice
Magic behind the numbers - software metrics in practice
 
CORRECT-ICSE2016
CORRECT-ICSE2016CORRECT-ICSE2016
CORRECT-ICSE2016
 
Programming with Relaxed Synchronization
Programming with Relaxed SynchronizationProgramming with Relaxed Synchronization
Programming with Relaxed Synchronization
 
How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)
 
Code lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf LinzCode lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf Linz
 
CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019
 
SAST, CWE, SEI CERT and other smart words from the information security world
SAST, CWE, SEI CERT and other smart words from the information security worldSAST, CWE, SEI CERT and other smart words from the information security world
SAST, CWE, SEI CERT and other smart words from the information security world
 
A Guide to Event-Driven SRE-inspired DevOps
A Guide to Event-Driven SRE-inspired DevOpsA Guide to Event-Driven SRE-inspired DevOps
A Guide to Event-Driven SRE-inspired DevOps
 
Sista: Improving Cog’s JIT performance
Sista: Improving Cog’s JIT performanceSista: Improving Cog’s JIT performance
Sista: Improving Cog’s JIT performance
 
Automated Test Suite Generation for Time-Continuous Simulink Models
Automated Test Suite Generation for Time-Continuous Simulink ModelsAutomated Test Suite Generation for Time-Continuous Simulink Models
Automated Test Suite Generation for Time-Continuous Simulink Models
 
Search for Vulnerabilities Using Static Code Analysis
Search for Vulnerabilities Using Static Code AnalysisSearch for Vulnerabilities Using Static Code Analysis
Search for Vulnerabilities Using Static Code Analysis
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Rails Software Metrics