SlideShare ist ein Scribd-Unternehmen logo
1 von 9
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 

Kürzlich hochgeladen (20)

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 

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