SlideShare a Scribd company logo
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

More Related Content

What's hot

Software Testing
Software TestingSoftware Testing
Software Testing
Mousmi Pawar
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1
Abou Bakr Ashraf
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and typesConfiz
 
System calls
System callsSystem calls
System calls
Bernard Senam
 
Introduction to Software Engineering
Introduction to Software EngineeringIntroduction to Software Engineering
Introduction to Software Engineering
Saqib Raza
 
Applets
AppletsApplets
Chapter 15 software product metrics
Chapter 15 software product metricsChapter 15 software product metrics
Chapter 15 software product metrics
SHREEHARI WADAWADAGI
 
User Interface Design in Software Engineering SE15
User Interface Design in Software Engineering SE15User Interface Design in Software Engineering SE15
User Interface Design in Software Engineering SE15koolkampus
 
Exception handling in ASP .NET
Exception handling in ASP .NETException handling in ASP .NET
Exception handling in ASP .NET
baabtra.com - No. 1 supplier of quality freshers
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
 
Software testing
Software testing Software testing
Software testing
Kunal Prajapati
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | Edureka
Edureka!
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
Dr. C.V. Suresh Babu
 
Java Basics
Java BasicsJava Basics
Java Basics
shivamgarg_nitj
 
Software Development Methodologies
Software Development MethodologiesSoftware Development Methodologies
Software Development Methodologies
Nicholas Davis
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
Bagzzz
 
Regression testing
Regression testingRegression testing
Regression testingMohua Amin
 
Integration testing
Integration testingIntegration testing
Integration testing
queen jemila
 

What's hot (20)

Software Testing
Software TestingSoftware Testing
Software Testing
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
 
JVM
JVMJVM
JVM
 
System calls
System callsSystem calls
System calls
 
White box ppt
White box pptWhite box ppt
White box ppt
 
Introduction to Software Engineering
Introduction to Software EngineeringIntroduction to Software Engineering
Introduction to Software Engineering
 
Applets
AppletsApplets
Applets
 
Chapter 15 software product metrics
Chapter 15 software product metricsChapter 15 software product metrics
Chapter 15 software product metrics
 
User Interface Design in Software Engineering SE15
User Interface Design in Software Engineering SE15User Interface Design in Software Engineering SE15
User Interface Design in Software Engineering SE15
 
Exception handling in ASP .NET
Exception handling in ASP .NETException handling in ASP .NET
Exception handling in ASP .NET
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Software testing
Software testing Software testing
Software testing
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | Edureka
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Software Development Methodologies
Software Development MethodologiesSoftware Development Methodologies
Software Development Methodologies
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
 
Regression testing
Regression testingRegression testing
Regression testing
 
Integration testing
Integration testingIntegration testing
Integration testing
 

Similar to Debugging

Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do it
Martin 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-patterns
Steven Smith
 
QA Best Practices
QA  Best PracticesQA  Best Practices
QA Best Practices
James 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 Flex
michael.labriola
 
Debugging
DebuggingDebugging
Debugging
Ajeng Savitri
 
debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).ppt
jerlinS1
 
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
 
Preocupações Desenvolvedor Ágil
Preocupações Desenvolvedor ÁgilPreocupações Desenvolvedor Ágil
Preocupações Desenvolvedor Ágil
Paulo Igor Alves Godinho
 
Test Drive Development
Test Drive DevelopmentTest Drive Development
Test Drive Development
satya sudheer
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
Lalit Kale
 
PHP - Introduction to PHP Bugs - Debugging
PHP -  Introduction to  PHP Bugs - DebuggingPHP -  Introduction to  PHP Bugs - Debugging
PHP - Introduction to PHP Bugs - Debugging
Vibrant Technologies & Computers
 
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 code
Yaki 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
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
priya_trivedi
 
Why unit testingl
Why unit testinglWhy unit testingl
Why unit testingl
Priya Sharma
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
priya_trivedi
 

Similar to 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
 

More from Jonathan Holloway

The Role of the Architect
The Role of the ArchitectThe Role of the Architect
The Role of the Architect
Jonathan Holloway
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
Jonathan Holloway
 
Jenkins CI presentation
Jenkins CI presentationJenkins CI presentation
Jenkins CI presentation
Jonathan Holloway
 
Mockito intro
Mockito introMockito intro
Mockito intro
Jonathan Holloway
 
SOLID principles
SOLID principlesSOLID principles
SOLID principles
Jonathan 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 AWS
Jonathan Holloway
 
Building data pipelines
Building data pipelinesBuilding data pipelines
Building data pipelines
Jonathan 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 flyway
Jonathan Holloway
 
Introduction to using MongoDB with Ruby
Introduction to using MongoDB with RubyIntroduction to using MongoDB with Ruby
Introduction to using MongoDB with Ruby
Jonathan Holloway
 

More from 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
 

Recently uploaded

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 

Recently uploaded (20)

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 

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