SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Debugging
Finding and solving
problems in software
What is debugging?
"Bug" and "debugging" are attributed to the
discovery of a moth found in a Mark II computer at
Harvard University.
Debugging is not troubleshooting
Debugging Rules...
1. Understand the system
2. Make it fail
3. Quit thinking and look
4. Divide and Conquer
5. Change one thing at a time
6. Keep an audit trail
7. Check the plug
8. Get a fresh view
9. If you didn't fix it, it aint fixed
Debugging - A Simple Method
a) Start
|
b) Construct a Hypothesis
|
c) Construct an Experiment
|
d) Hypothesis Proved? - goto b)
|
Need more evidence? - goto c)
|
Stop
1. Understanding the System
Know the fundamentals of the system
Understand the frameworks involved
Read the API's and communication interfaces
Know your tools
Understand what each module of the system does
2. Make it Fail
Start at the beginning
Automate the failure
No detail is insignificant
Intermittent failures?
Isolate the failure
Build debugging tools and test harnesses
3. Quit thinking and look
Gather the low level details and "see" the failure
Understand the context of the bug
Design instrumentation in:
●Runtime statistics
●Status messages
●Debug logging - be descriptive!!!
●Deployment time environment checks
Hypothesise and test
4. Divide and Conquer
Narrow the search down, software AND
hardware. Successive approximation.
Start at the bad end (e.g. the error log) and work
your way up the chain looking at the various
points on the way
Fix the bugs you know about - fixing one could
fix the other
Fix the noise first, but don't go nuts
5. Change one thing at a time
Compare with a good one !
Use a rifle not a shotgun
What's changed recently, it used to work!
Separate environment and product
6. Keep an audit trail
Keep a day book of what you did
During debugging write down...
1.What you did...
2.In what order...
3.And what happened!
Be specific and consistent
Correlate symptoms with others
Version control and change logs are great for
determining an audit trail of what's changed
7. Check the plug
Question your assumptions
8. Get a Fresh View
Get another viewpoint on the solution
Talk to somebody about the problem
Ask an expert:
●Email the author
●Check the forums
●Subscribe to the mailing list
Make sure you report symptoms not theories
9. If you didn't fix it, it aint fixed!
The most important lesson by far...
●Fix the root cause
●Make sure it can't possibly happen again
●Fix the process at fault
"We didn't see an issue until we deployed into the production
environment"
= Deploy early and deploy often
Debugging Methods and Tools
Debugging Methods
Print/Trace Debugging - watching the flow of execution after
adding print statements to the original code
Remote Debugging - connect to a remote system with a
debugger, monitor the execution and state
Post Mortem Debugging - analysis of a memory dump from a
program that has crashed
Profiling - not debugging per se, but a useful technique for
analysing a running program to look for issues
Lesser Known (?) Debugging Methods
Rubber Ducking - explaining your problem to someone
else. Stating the problem aloud in order to work it out.
Failfirst - Write a unit test that exposes the failure, correct the
code and make it pass
Saff Squeeze - Write a system test, inline code, write test, repeat
until fixed
http://www.threeriversinstitute.org/HitEmHighHitEmLow.html
Chaos Monkey - AWS Netflix approach - randomly kill and test
areas. Fail consistently to test fault tolerant software.
http://www.codinghorror.com/blog/2011/04/working-with-the-chaos-monkey.html
Eclipse Debugging 1
Set breakpoints in the code
Step into, over, return
Watches - display a variable value
Hit counts
Setting an exception breakpoint
Setting a method breakpoint
Eclipse Debugging 2
Class load breakpoint
Using display after a breakpoint has been hit
Attaching a remote debugger via a JDB agent
Bug Taxonomies and Bug Types
There are ways to categorise bugs... lots of
taxonomies available from research literature
Some bug types include:
●Bohrbug - bug that manifests itself consistently
under a set of conditions
●Heisenbug - bug that alters its' characteristics
when studied
Preventing Bugs
Debugging is hard and expensive in terms of fixing
the bug, testing it and re-deploying it...
We can try and prevent bugs with:
●Code Review
●Defensive Programming
●Precondition, postcondition and invariant checking
●Assertions
Further Resources
●Debugging - The 9 Indispensable Rules for Finding
Even The Most Elusive Software and Hardware
Problems - David Agans
●Debug It! : Find, Repair and Prevent Bugs in Your
Code (Pragmatic Programmers) - Paul Butcher
●Testing Education -
http://www.testingeducation.org/a/bugtax.pdf
●Lars Vogels Debugging Overview (2011) -
http://www.vogella.de/articles/EclipseDebugging/artic

Weitere ähnliche Inhalte

Was ist angesagt?

Advanced topics in software engineering
Advanced topics in software engineeringAdvanced topics in software engineering
Advanced topics in software engineeringRupesh Vaishnav
 
Formal Specification in Software Engineering SE9
Formal Specification in Software Engineering SE9Formal Specification in Software Engineering SE9
Formal Specification in Software Engineering SE9koolkampus
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | EdurekaEdureka!
 
White Box Testing
White Box TestingWhite Box Testing
White Box TestingAlisha Roy
 
Presentation on-exception-handling
Presentation on-exception-handlingPresentation on-exception-handling
Presentation on-exception-handlingNahian Ahmed
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET frameworkRicha Handa
 
Software testing & Quality Assurance
Software testing & Quality Assurance Software testing & Quality Assurance
Software testing & Quality Assurance Webtech Learning
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Michelle Anne Meralpis
 
Language processing activity
Language processing activityLanguage processing activity
Language processing activityDhruv Sabalpara
 
Algorithmic problem solving
Algorithmic problem solvingAlgorithmic problem solving
Algorithmic problem solvingPrabhakaran V M
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming ParadigmsDirecti Group
 
input/ output in java
input/ output  in javainput/ output  in java
input/ output in javasharma230399
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box TestingTestbytes
 
Learn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat ShahriyarLearn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat ShahriyarAbir Mohammad
 

Was ist angesagt? (20)

Java-java virtual machine
Java-java virtual machineJava-java virtual machine
Java-java virtual machine
 
Advanced topics in software engineering
Advanced topics in software engineeringAdvanced topics in software engineering
Advanced topics in software engineering
 
Formal Specification in Software Engineering SE9
Formal Specification in Software Engineering SE9Formal Specification in Software Engineering SE9
Formal Specification in Software Engineering SE9
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | Edureka
 
White Box Testing
White Box TestingWhite Box Testing
White Box Testing
 
Presentation on-exception-handling
Presentation on-exception-handlingPresentation on-exception-handling
Presentation on-exception-handling
 
Software testing axioms
Software testing axiomsSoftware testing axioms
Software testing axioms
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET framework
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 
Software testing & Quality Assurance
Software testing & Quality Assurance Software testing & Quality Assurance
Software testing & Quality Assurance
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
 
Notes on Debugging
Notes on DebuggingNotes on Debugging
Notes on Debugging
 
Language processing activity
Language processing activityLanguage processing activity
Language processing activity
 
Algorithmic problem solving
Algorithmic problem solvingAlgorithmic problem solving
Algorithmic problem solving
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming Paradigms
 
input/ output in java
input/ output  in javainput/ output  in java
input/ output in java
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
 
Pass 1 flowchart
Pass 1 flowchartPass 1 flowchart
Pass 1 flowchart
 
Learn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat ShahriyarLearn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat Shahriyar
 

Ähnlich wie Debugging

Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do itMartin Sykora
 
5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-Testing5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-TestingMary Clemons
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsSteven Smith
 
QA Best Practices
QA  Best PracticesQA  Best Practices
QA Best PracticesJames York
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flexmichael.labriola
 
debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).pptjerlinS1
 
An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...jeyasrig
 
Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Dror Helper
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Qualityguest268ee8
 
Test Drive Development
Test Drive DevelopmentTest Drive Development
Test Drive Developmentsatya sudheer
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelinesLalit Kale
 
6 easy bug tracking tips & tricks every developer should know!
6 easy bug tracking tips & tricks every developer should know!6 easy bug tracking tips & tricks every developer should know!
6 easy bug tracking tips & tricks every developer should know!Thomas Peham
 
Stop fearing legacy code
Stop fearing legacy codeStop fearing legacy code
Stop fearing legacy codeYaki Koren
 
Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)Acquia
 

Ähnlich wie Debugging (20)

Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do it
 
5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-Testing5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-Testing
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patterns
 
QA Best Practices
QA  Best PracticesQA  Best Practices
QA Best Practices
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
 
Debugging
DebuggingDebugging
Debugging
 
debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).ppt
 
An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...
 
Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Quality
 
Preocupações Desenvolvedor Ágil
Preocupações Desenvolvedor ÁgilPreocupações Desenvolvedor Ágil
Preocupações Desenvolvedor Ágil
 
Test Drive Development
Test Drive DevelopmentTest Drive Development
Test Drive Development
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
PHP - Introduction to PHP Bugs - Debugging
PHP -  Introduction to  PHP Bugs - DebuggingPHP -  Introduction to  PHP Bugs - Debugging
PHP - Introduction to PHP Bugs - Debugging
 
6 easy bug tracking tips & tricks every developer should know!
6 easy bug tracking tips & tricks every developer should know!6 easy bug tracking tips & tricks every developer should know!
6 easy bug tracking tips & tricks every developer should know!
 
Stop fearing legacy code
Stop fearing legacy codeStop fearing legacy code
Stop fearing legacy code
 
Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
 
Why unit testingl
Why unit testinglWhy unit testingl
Why unit testingl
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
 

Mehr von Jonathan Holloway

Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introductionJonathan Holloway
 
Application design for the cloud using AWS
Application design for the cloud using AWSApplication design for the cloud using AWS
Application design for the cloud using AWSJonathan Holloway
 
Introduction to JVM languages and Fantom (very brief)
Introduction to JVM languages and Fantom (very brief)Introduction to JVM languages and Fantom (very brief)
Introduction to JVM languages and Fantom (very brief)Jonathan Holloway
 
Database migration with flyway
Database migration  with flywayDatabase migration  with flyway
Database migration with flywayJonathan Holloway
 
Introduction to using MongoDB with Ruby
Introduction to using MongoDB with RubyIntroduction to using MongoDB with Ruby
Introduction to using MongoDB with RubyJonathan Holloway
 

Mehr von Jonathan Holloway (11)

The Role of the Architect
The Role of the ArchitectThe Role of the Architect
The Role of the Architect
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Jenkins CI presentation
Jenkins CI presentationJenkins CI presentation
Jenkins CI presentation
 
Mockito intro
Mockito introMockito intro
Mockito intro
 
SOLID principles
SOLID principlesSOLID principles
SOLID principles
 
Application design for the cloud using AWS
Application design for the cloud using AWSApplication design for the cloud using AWS
Application design for the cloud using AWS
 
Building data pipelines
Building data pipelinesBuilding data pipelines
Building data pipelines
 
Introduction to JVM languages and Fantom (very brief)
Introduction to JVM languages and Fantom (very brief)Introduction to JVM languages and Fantom (very brief)
Introduction to JVM languages and Fantom (very brief)
 
Database migration with flyway
Database migration  with flywayDatabase migration  with flyway
Database migration with flyway
 
Lightweight web frameworks
Lightweight web frameworksLightweight web frameworks
Lightweight web frameworks
 
Introduction to using MongoDB with Ruby
Introduction to using MongoDB with RubyIntroduction to using MongoDB with Ruby
Introduction to using MongoDB with Ruby
 

Kürzlich hochgeladen

Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
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
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
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
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
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
 
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
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
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...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
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
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
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...
 
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
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

Debugging

  • 2. What is debugging? "Bug" and "debugging" are attributed to the discovery of a moth found in a Mark II computer at Harvard University. Debugging is not troubleshooting
  • 3. Debugging Rules... 1. Understand the system 2. Make it fail 3. Quit thinking and look 4. Divide and Conquer 5. Change one thing at a time 6. Keep an audit trail 7. Check the plug 8. Get a fresh view 9. If you didn't fix it, it aint fixed
  • 4. Debugging - A Simple Method a) Start | b) Construct a Hypothesis | c) Construct an Experiment | d) Hypothesis Proved? - goto b) | Need more evidence? - goto c) | Stop
  • 5. 1. Understanding the System Know the fundamentals of the system Understand the frameworks involved Read the API's and communication interfaces Know your tools Understand what each module of the system does
  • 6. 2. Make it Fail Start at the beginning Automate the failure No detail is insignificant Intermittent failures? Isolate the failure Build debugging tools and test harnesses
  • 7. 3. Quit thinking and look Gather the low level details and "see" the failure Understand the context of the bug Design instrumentation in: ●Runtime statistics ●Status messages ●Debug logging - be descriptive!!! ●Deployment time environment checks Hypothesise and test
  • 8. 4. Divide and Conquer Narrow the search down, software AND hardware. Successive approximation. Start at the bad end (e.g. the error log) and work your way up the chain looking at the various points on the way Fix the bugs you know about - fixing one could fix the other Fix the noise first, but don't go nuts
  • 9. 5. Change one thing at a time Compare with a good one ! Use a rifle not a shotgun What's changed recently, it used to work! Separate environment and product
  • 10. 6. Keep an audit trail Keep a day book of what you did During debugging write down... 1.What you did... 2.In what order... 3.And what happened! Be specific and consistent Correlate symptoms with others Version control and change logs are great for determining an audit trail of what's changed
  • 11. 7. Check the plug Question your assumptions
  • 12. 8. Get a Fresh View Get another viewpoint on the solution Talk to somebody about the problem Ask an expert: ●Email the author ●Check the forums ●Subscribe to the mailing list Make sure you report symptoms not theories
  • 13. 9. If you didn't fix it, it aint fixed! The most important lesson by far... ●Fix the root cause ●Make sure it can't possibly happen again ●Fix the process at fault "We didn't see an issue until we deployed into the production environment" = Deploy early and deploy often
  • 15. Debugging Methods Print/Trace Debugging - watching the flow of execution after adding print statements to the original code Remote Debugging - connect to a remote system with a debugger, monitor the execution and state Post Mortem Debugging - analysis of a memory dump from a program that has crashed Profiling - not debugging per se, but a useful technique for analysing a running program to look for issues
  • 16. Lesser Known (?) Debugging Methods Rubber Ducking - explaining your problem to someone else. Stating the problem aloud in order to work it out. Failfirst - Write a unit test that exposes the failure, correct the code and make it pass Saff Squeeze - Write a system test, inline code, write test, repeat until fixed http://www.threeriversinstitute.org/HitEmHighHitEmLow.html Chaos Monkey - AWS Netflix approach - randomly kill and test areas. Fail consistently to test fault tolerant software. http://www.codinghorror.com/blog/2011/04/working-with-the-chaos-monkey.html
  • 17. Eclipse Debugging 1 Set breakpoints in the code Step into, over, return Watches - display a variable value Hit counts Setting an exception breakpoint Setting a method breakpoint
  • 18. Eclipse Debugging 2 Class load breakpoint Using display after a breakpoint has been hit Attaching a remote debugger via a JDB agent
  • 19. Bug Taxonomies and Bug Types There are ways to categorise bugs... lots of taxonomies available from research literature Some bug types include: ●Bohrbug - bug that manifests itself consistently under a set of conditions ●Heisenbug - bug that alters its' characteristics when studied
  • 20. Preventing Bugs Debugging is hard and expensive in terms of fixing the bug, testing it and re-deploying it... We can try and prevent bugs with: ●Code Review ●Defensive Programming ●Precondition, postcondition and invariant checking ●Assertions
  • 21. Further Resources ●Debugging - The 9 Indispensable Rules for Finding Even The Most Elusive Software and Hardware Problems - David Agans ●Debug It! : Find, Repair and Prevent Bugs in Your Code (Pragmatic Programmers) - Paul Butcher ●Testing Education - http://www.testingeducation.org/a/bugtax.pdf ●Lars Vogels Debugging Overview (2011) - http://www.vogella.de/articles/EclipseDebugging/artic