SlideShare une entreprise Scribd logo
1  sur  9
Télécharger pour lire hors ligne
EXCUSE ME BUT…YOUR CODE SMELLS
Unlike touch and taste, the sense of smell can detect odors
from a distance. This certainly comes in handy to prevent us
from eating something poisonous, or giving advance warning
of danger in our environment.
So what does this have to do with code?
For over 20 years, software engineers have used code smells
to detect problems in their source code. Why? Because
smells are early warnings!
A code smell is any symptom in the source code of an
application or system that indicates a deeper problem,
such as weaknesses in design or system vulnerabilities
that may increase the risk of future failures.
DON’T TAKE IT PERSONALLY
A human
nose can
detect over
10,000
different
smells!
A code smell hints that something is wrong in the source
code that runs your system. Good software engineers
employ automated code smelling tools such as code
quality analysis to detect, identify, and track down these
potential weaknesses in their code.
Functional testing is not enough.
Functional testing only evaluates a system's compliance
with its specified requirements, while automated tools
examine the actual code to highlight weakness, and
identify high value targets for refactoring. According to
Capers Jones, “A synergistic combination of formal
inspections, static analysis, and formal testing can achieve
combined defect removal efficiency levels of 99%.”
WHAT’S IN A CODE SMELL?
Kent Beck
coined
the term
Code Smell
- Refactoring: Improving
the Design of Existing Code
Like the seven primary smells that your
nose can identify, code smells can be
classified to help you understand the
type of issues that may be present in
source code.
Research indicates that code smells correlate to maintainability
and production issues, which means detecting code smells
prior to releasing code into production helps improve system
maintainability and reliability.
Therefore, automatic detection of code smells is a valuable
early warning system that can benefit virtually every
development organization.
OH MY….WHAT’S THAT SMELL?
7 Types of
Smells
• Camphoric (Mothballs)
• Musky (Perfume)
• Roses (Floral)
• Pepperminty
• Etheral (Dry Cleaning Fluid)
• Pungent (Vinegar)
• Putrid (Rotten Eggs)
7 Examples of
Code Smells
• Duplicated code
• Long methods
• Large class
• Too many parameters
• Inappropriate intimacy
• Contrived complexity
• Excessively long identifiers
1010101010101101010101
0101010101011010101010
1010101010010101111010
1010101010101010101010
1010101010101011010101
0101011010101010101010
1010110101010101010101
0100101011110101010101
0101010101010101010101
0101010110101010101011
0101010101010101010110
Code smells can be
detected by a static code
quality agent that can read
source code. The agent
builds a representation of
the code, then checks it
against a set of patterns.
HOW TO SMELL YOUR CODE
POOR GOOD EXCELLENT
Size
Complexity
Best Practices
Stability
Maintainability
The agent looks at the
occurrences of bad code
patterns. The presence of one
instance of a pattern doesn’t
mean the code smells;
however, many occurrences
may trigger a threshold that
indicates the code is starting
to smell.
The agent aggregates the
results of the pattern detection
and generates code quality
metrics (ie. number of lines of
code, comment density, code
complexity). These metrics and
indicators are used to determine
how much and what type of
risky behaviors have been
detected in the code.
The annual impact of bad software is estimated to be $59
billion and over 90% of the vulnerabilities that cause these
defects are in source code.
Analyzing critical systems to detect code smells prior to
release provides benefits well beyond simple functional
testing. Automated code smell detection is a fast, reliable
risk reduction tool that should applied to all critical systems
to ensure early identification of potential issues and prevent
costly system outages and repair efforts.
THE IMPORTANCE OF SMELL
Early
Warning
Indicators
Recent high-profile IT failures that may have benefitted from code-smelling.
MY CODE STINKS…NOW WHAT?
Transparency into the state of critical systems is difficult, yet
crucial to any organization. Once you’ve scanned your critical
systems, the next step is to determine root cause. Code can
go bad at many levels – programmer, process, architectural,
and even organizational. The key is that by analyzing and
measuring your code regularly you have the visibility and
facts needed to isolate root cause.
Bad things happen to good code.
Even great code will start to smell bad over time as fixes and
enhancements are introduced into the code base. However,
there are simple precautions you can take to detect potential
vulnerabilities early.
Gain
Visibility &
Monitor
Regularly
WAKE UP AND SMELL YOUR CODE!
Mission critical applications come with risks that have
significant business consequences. The conditions that
produce these risks grows steadily worse, as applications
become larger and more complex and demand from the
market to be more agile to compete increases. These are
perfect conditions that lead to headline making disasters
and end careers.
You must find ways to control the internal quality of your
systems. Identifying code smells through automated code
quality analysis is a scalable and effective method to
monitor critical systems evolution, improve maintainability,
and reduce the likelihood of production outages.
Identify &
Prevent Risk
START SMELLING LIKE A ROSE
Get visibility – Chance are you have no idea what your
code smells like. Have your teams perform code quality
analysis to establish a baseline of internal structural
quality.
Monitor – Insist that product teams regularly measure
and report on the internal quality of mission critical
systems. Require clear plans to mitigate these
vulnerabilities.
Communicate – Use this information as the foundation of
a continuing dialogue with your team to close process
gaps and develop needed skill sets.
Ask CAST for help – We’ve been helping clients prevent
bad code from impacting good businesses for over 15
years.
Try
CAST HIGHLIGHT!
www.casthighlight.com/demo
Rapid Application Portfolio
Analysis

Contenu connexe

Plus de CAST

Six steps-to-enhance-performance-of-critical-systems
Six steps-to-enhance-performance-of-critical-systemsSix steps-to-enhance-performance-of-critical-systems
Six steps-to-enhance-performance-of-critical-systemsCAST
 
Application Performance: 6 Steps to Enhance Performance of Critical Systems
Application Performance: 6 Steps to Enhance Performance of Critical SystemsApplication Performance: 6 Steps to Enhance Performance of Critical Systems
Application Performance: 6 Steps to Enhance Performance of Critical SystemsCAST
 
Application Assessment - Executive Summary Report
Application Assessment - Executive Summary ReportApplication Assessment - Executive Summary Report
Application Assessment - Executive Summary ReportCAST
 
Cloud Migration: Azure acceleration with CAST Highlight
Cloud Migration: Azure acceleration with CAST HighlightCloud Migration: Azure acceleration with CAST Highlight
Cloud Migration: Azure acceleration with CAST HighlightCAST
 
Cloud Readiness : CAST & Microsoft Azure Partnership Overview
Cloud Readiness : CAST & Microsoft Azure Partnership OverviewCloud Readiness : CAST & Microsoft Azure Partnership Overview
Cloud Readiness : CAST & Microsoft Azure Partnership OverviewCAST
 
Cloud Migration: Cloud Readiness Assessment Case Study
Cloud Migration: Cloud Readiness Assessment Case StudyCloud Migration: Cloud Readiness Assessment Case Study
Cloud Migration: Cloud Readiness Assessment Case StudyCAST
 
Digital Transformation e-book: Taking the 20X20n approach to accelerating Dig...
Digital Transformation e-book: Taking the 20X20n approach to accelerating Dig...Digital Transformation e-book: Taking the 20X20n approach to accelerating Dig...
Digital Transformation e-book: Taking the 20X20n approach to accelerating Dig...CAST
 
Why computers will never be safe
Why computers will never be safeWhy computers will never be safe
Why computers will never be safeCAST
 
Green indexes used in CAST to measure the energy consumption in code
Green indexes used in CAST to measure the energy consumption in codeGreen indexes used in CAST to measure the energy consumption in code
Green indexes used in CAST to measure the energy consumption in codeCAST
 
9 Steps to Creating ADM Budgets
9 Steps to Creating ADM Budgets9 Steps to Creating ADM Budgets
9 Steps to Creating ADM BudgetsCAST
 
Improving ADM Vendor Relationship through Outcome Based Contracts
Improving ADM Vendor Relationship through Outcome Based ContractsImproving ADM Vendor Relationship through Outcome Based Contracts
Improving ADM Vendor Relationship through Outcome Based ContractsCAST
 
Drive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
Drive Business Excellence with Outcomes-Based Contracting: The OBC ToolkitDrive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
Drive Business Excellence with Outcomes-Based Contracting: The OBC ToolkitCAST
 
CAST Highlight: Code-level portfolio analysis. FAST.
CAST Highlight: Code-level portfolio analysis. FAST.CAST Highlight: Code-level portfolio analysis. FAST.
CAST Highlight: Code-level portfolio analysis. FAST.CAST
 
Shifting Vendor Management Focus to Risk and Business Outcomes
Shifting Vendor Management Focus to Risk and Business OutcomesShifting Vendor Management Focus to Risk and Business Outcomes
Shifting Vendor Management Focus to Risk and Business OutcomesCAST
 
Applying Software Quality Models to Software Security
Applying Software Quality Models to Software SecurityApplying Software Quality Models to Software Security
Applying Software Quality Models to Software SecurityCAST
 
The business case for software analysis & measurement
The business case for software analysis & measurementThe business case for software analysis & measurement
The business case for software analysis & measurementCAST
 
Cast Highlight Software Maintenance Infographic
Cast Highlight Software Maintenance InfographicCast Highlight Software Maintenance Infographic
Cast Highlight Software Maintenance InfographicCAST
 
What is system level analysis
What is system level analysisWhat is system level analysis
What is system level analysisCAST
 
Deloitte Tech Trends 2014 Technical Debt
Deloitte Tech Trends 2014 Technical DebtDeloitte Tech Trends 2014 Technical Debt
Deloitte Tech Trends 2014 Technical DebtCAST
 
What you should know about software measurement platforms
What you should know about software measurement platformsWhat you should know about software measurement platforms
What you should know about software measurement platformsCAST
 

Plus de CAST (20)

Six steps-to-enhance-performance-of-critical-systems
Six steps-to-enhance-performance-of-critical-systemsSix steps-to-enhance-performance-of-critical-systems
Six steps-to-enhance-performance-of-critical-systems
 
Application Performance: 6 Steps to Enhance Performance of Critical Systems
Application Performance: 6 Steps to Enhance Performance of Critical SystemsApplication Performance: 6 Steps to Enhance Performance of Critical Systems
Application Performance: 6 Steps to Enhance Performance of Critical Systems
 
Application Assessment - Executive Summary Report
Application Assessment - Executive Summary ReportApplication Assessment - Executive Summary Report
Application Assessment - Executive Summary Report
 
Cloud Migration: Azure acceleration with CAST Highlight
Cloud Migration: Azure acceleration with CAST HighlightCloud Migration: Azure acceleration with CAST Highlight
Cloud Migration: Azure acceleration with CAST Highlight
 
Cloud Readiness : CAST & Microsoft Azure Partnership Overview
Cloud Readiness : CAST & Microsoft Azure Partnership OverviewCloud Readiness : CAST & Microsoft Azure Partnership Overview
Cloud Readiness : CAST & Microsoft Azure Partnership Overview
 
Cloud Migration: Cloud Readiness Assessment Case Study
Cloud Migration: Cloud Readiness Assessment Case StudyCloud Migration: Cloud Readiness Assessment Case Study
Cloud Migration: Cloud Readiness Assessment Case Study
 
Digital Transformation e-book: Taking the 20X20n approach to accelerating Dig...
Digital Transformation e-book: Taking the 20X20n approach to accelerating Dig...Digital Transformation e-book: Taking the 20X20n approach to accelerating Dig...
Digital Transformation e-book: Taking the 20X20n approach to accelerating Dig...
 
Why computers will never be safe
Why computers will never be safeWhy computers will never be safe
Why computers will never be safe
 
Green indexes used in CAST to measure the energy consumption in code
Green indexes used in CAST to measure the energy consumption in codeGreen indexes used in CAST to measure the energy consumption in code
Green indexes used in CAST to measure the energy consumption in code
 
9 Steps to Creating ADM Budgets
9 Steps to Creating ADM Budgets9 Steps to Creating ADM Budgets
9 Steps to Creating ADM Budgets
 
Improving ADM Vendor Relationship through Outcome Based Contracts
Improving ADM Vendor Relationship through Outcome Based ContractsImproving ADM Vendor Relationship through Outcome Based Contracts
Improving ADM Vendor Relationship through Outcome Based Contracts
 
Drive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
Drive Business Excellence with Outcomes-Based Contracting: The OBC ToolkitDrive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
Drive Business Excellence with Outcomes-Based Contracting: The OBC Toolkit
 
CAST Highlight: Code-level portfolio analysis. FAST.
CAST Highlight: Code-level portfolio analysis. FAST.CAST Highlight: Code-level portfolio analysis. FAST.
CAST Highlight: Code-level portfolio analysis. FAST.
 
Shifting Vendor Management Focus to Risk and Business Outcomes
Shifting Vendor Management Focus to Risk and Business OutcomesShifting Vendor Management Focus to Risk and Business Outcomes
Shifting Vendor Management Focus to Risk and Business Outcomes
 
Applying Software Quality Models to Software Security
Applying Software Quality Models to Software SecurityApplying Software Quality Models to Software Security
Applying Software Quality Models to Software Security
 
The business case for software analysis & measurement
The business case for software analysis & measurementThe business case for software analysis & measurement
The business case for software analysis & measurement
 
Cast Highlight Software Maintenance Infographic
Cast Highlight Software Maintenance InfographicCast Highlight Software Maintenance Infographic
Cast Highlight Software Maintenance Infographic
 
What is system level analysis
What is system level analysisWhat is system level analysis
What is system level analysis
 
Deloitte Tech Trends 2014 Technical Debt
Deloitte Tech Trends 2014 Technical DebtDeloitte Tech Trends 2014 Technical Debt
Deloitte Tech Trends 2014 Technical Debt
 
What you should know about software measurement platforms
What you should know about software measurement platformsWhat you should know about software measurement platforms
What you should know about software measurement platforms
 

Dernier

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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...Neo4j
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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 FMESafe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
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 WorkerThousandEyes
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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...DianaGray10
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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 organizationRadu Cotescu
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Dernier (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Excuse Me But...Your Code Smells.

  • 1. EXCUSE ME BUT…YOUR CODE SMELLS
  • 2. Unlike touch and taste, the sense of smell can detect odors from a distance. This certainly comes in handy to prevent us from eating something poisonous, or giving advance warning of danger in our environment. So what does this have to do with code? For over 20 years, software engineers have used code smells to detect problems in their source code. Why? Because smells are early warnings! A code smell is any symptom in the source code of an application or system that indicates a deeper problem, such as weaknesses in design or system vulnerabilities that may increase the risk of future failures. DON’T TAKE IT PERSONALLY A human nose can detect over 10,000 different smells!
  • 3. A code smell hints that something is wrong in the source code that runs your system. Good software engineers employ automated code smelling tools such as code quality analysis to detect, identify, and track down these potential weaknesses in their code. Functional testing is not enough. Functional testing only evaluates a system's compliance with its specified requirements, while automated tools examine the actual code to highlight weakness, and identify high value targets for refactoring. According to Capers Jones, “A synergistic combination of formal inspections, static analysis, and formal testing can achieve combined defect removal efficiency levels of 99%.” WHAT’S IN A CODE SMELL? Kent Beck coined the term Code Smell - Refactoring: Improving the Design of Existing Code
  • 4. Like the seven primary smells that your nose can identify, code smells can be classified to help you understand the type of issues that may be present in source code. Research indicates that code smells correlate to maintainability and production issues, which means detecting code smells prior to releasing code into production helps improve system maintainability and reliability. Therefore, automatic detection of code smells is a valuable early warning system that can benefit virtually every development organization. OH MY….WHAT’S THAT SMELL? 7 Types of Smells • Camphoric (Mothballs) • Musky (Perfume) • Roses (Floral) • Pepperminty • Etheral (Dry Cleaning Fluid) • Pungent (Vinegar) • Putrid (Rotten Eggs) 7 Examples of Code Smells • Duplicated code • Long methods • Large class • Too many parameters • Inappropriate intimacy • Contrived complexity • Excessively long identifiers
  • 5. 1010101010101101010101 0101010101011010101010 1010101010010101111010 1010101010101010101010 1010101010101011010101 0101011010101010101010 1010110101010101010101 0100101011110101010101 0101010101010101010101 0101010110101010101011 0101010101010101010110 Code smells can be detected by a static code quality agent that can read source code. The agent builds a representation of the code, then checks it against a set of patterns. HOW TO SMELL YOUR CODE POOR GOOD EXCELLENT Size Complexity Best Practices Stability Maintainability The agent looks at the occurrences of bad code patterns. The presence of one instance of a pattern doesn’t mean the code smells; however, many occurrences may trigger a threshold that indicates the code is starting to smell. The agent aggregates the results of the pattern detection and generates code quality metrics (ie. number of lines of code, comment density, code complexity). These metrics and indicators are used to determine how much and what type of risky behaviors have been detected in the code.
  • 6. The annual impact of bad software is estimated to be $59 billion and over 90% of the vulnerabilities that cause these defects are in source code. Analyzing critical systems to detect code smells prior to release provides benefits well beyond simple functional testing. Automated code smell detection is a fast, reliable risk reduction tool that should applied to all critical systems to ensure early identification of potential issues and prevent costly system outages and repair efforts. THE IMPORTANCE OF SMELL Early Warning Indicators Recent high-profile IT failures that may have benefitted from code-smelling.
  • 7. MY CODE STINKS…NOW WHAT? Transparency into the state of critical systems is difficult, yet crucial to any organization. Once you’ve scanned your critical systems, the next step is to determine root cause. Code can go bad at many levels – programmer, process, architectural, and even organizational. The key is that by analyzing and measuring your code regularly you have the visibility and facts needed to isolate root cause. Bad things happen to good code. Even great code will start to smell bad over time as fixes and enhancements are introduced into the code base. However, there are simple precautions you can take to detect potential vulnerabilities early. Gain Visibility & Monitor Regularly
  • 8. WAKE UP AND SMELL YOUR CODE! Mission critical applications come with risks that have significant business consequences. The conditions that produce these risks grows steadily worse, as applications become larger and more complex and demand from the market to be more agile to compete increases. These are perfect conditions that lead to headline making disasters and end careers. You must find ways to control the internal quality of your systems. Identifying code smells through automated code quality analysis is a scalable and effective method to monitor critical systems evolution, improve maintainability, and reduce the likelihood of production outages. Identify & Prevent Risk
  • 9. START SMELLING LIKE A ROSE Get visibility – Chance are you have no idea what your code smells like. Have your teams perform code quality analysis to establish a baseline of internal structural quality. Monitor – Insist that product teams regularly measure and report on the internal quality of mission critical systems. Require clear plans to mitigate these vulnerabilities. Communicate – Use this information as the foundation of a continuing dialogue with your team to close process gaps and develop needed skill sets. Ask CAST for help – We’ve been helping clients prevent bad code from impacting good businesses for over 15 years. Try CAST HIGHLIGHT! www.casthighlight.com/demo Rapid Application Portfolio Analysis