SlideShare uma empresa Scribd logo
1 de 36
Baixar para ler offline
Debugging
   Applications
               Author: Tien Do




         22-Dec-01

   24mB Software Development
What We Will Cover
 Defining the different types of bugs
 Learn how to write applications with
 fewer bugs in the first place
 Developing a proactive process for
 debugging that all great developers
 follow
Today’s Agenda
 The gestalt of bug
 Avoid bug in the first place
 The proactive debugging process
The Gestalt of Bug




       24mB Software Development
What Are Bugs?
 Inconsistent user interfaces
 Unmet expectations
 Poor performance
 Crashes or data corruption
Process Bugs and
Solutions
 Short or impossible deadlines
 The quot;code first, think laterquot;
 approach
 Misunderstood requirements
 Lack of knowledge
 Lack of commitment to quality
Short or Impossible
Deadlines
 Unrealistic schedules
 Underestimate how long to develop
 a solid product
 Leads to cut corners and a lower
 quality product
 Ship dates should be based on a
 feature set
The “Code First, Think
Laterquot; Approach
 Starts programming before they
 start thinking
 Very few like to write documents
 Introduce more bugs into an
 already unstable code
 The solution is simple: plan your
 projects
Misunderstood
Requirements
 Feature creep causes more bugs
 than almost anything else
 quot;paper prototypesquot; the user
 interface
 Really understand the products'
 requirements
 Spend adequate time to understand
 the problem domain
Lack of Knowledge
 Don't understand the OS, the
 language, or the technology
 No one can be expected to know
 the ins and outs of everything
 Acknowledging the strengths and
 limitations
 Strengthening every developer's
 weaknesses
Lack of Commitment To
Quality
 The most serious problem
 Company's commitment sets the
 tone for the entire team
 Make code the most robust and
 extensible
Avoid Bug In The First
Place




      24mB Software Development
Planning for Debugging
 Think about debugging right from
 the beginning
 Plan for exactly what will change
 Adding a feature doesn't affect just
 the code
 Goes together with planning for
 testing
 Code should tell you where the
 bugs are
Prerequisites to
Debugging
 Know   your   project
 Know   your   language
 Know   your   technology
 Know   your   operating system
 Know   your   CPU
Learning the Skill Set
 Study continually just to keep up
 The ultimate way to learn is by
 doing
 Look at other developers' code
 Never be afraid to ask others
 Read programming newsgroup
Assert, Assert, Assert, and
Assert
 The key proactive programming tool
 for debugging
 Using in addition to normal error
 checking
 Tell where and why a condition was
 invalid
 Serve as reminders to others
How to Assert
 Should never change any variables
 or states of a application
 Check a single item at a time
 Strive to check the condition
 completely
 Assert against specific values
 Real error handling immediately
 follows the assertion
What to Assert
 The parameters coming into a
 function
 The return values
 Any assumption
Trace, Trace, Trace, and
Trace
 Useful when used correctly with
 assertions
 Should associate with paths through
 the code
 Avoid putting trace statements
 inside tight loops
 Everyone uses a similar format
Comment, Comment,
Comment, and Comment
 The only way to make code
 maintainable
 Doesn’t mean duplicate the code
 Mean documenting assumptions,
 approach, and reasons
 Keep coordinated with the code
 Well-placed trace, assertions, and
 good naming conventions are also
 good comments
Unit Testing
 Unit testing is how you verify
 yourself
 Writing unit tests as soon as writing
 code
 Run unit tests all the time during
 coding
 Code coverage
 Keep unit tests as part of the code
 base
Bug Tracking Systems
 Track all the bugs of the project
 Keep notes and to-do lists in one
 place
 Better predict when your product
 will be ready to ship
 Hallmarks of a good software team
Frequent Builds and
Smoke Tests
 Build the application once a day
 Building both release and debug
 versions at the same time
 Build with the latest master sources
 Checks product's basic functionality
 Contain at least one test for every
 feature
The Proactive Debugging
Process




      24mB Software Development
The Steps Illustration
Step 1: Duplicate the Bug
 The most critical step
 Sometimes difficult, or even
 impossible
 Try to get bugs through multiple
 paths
 Some bugs can mask others
 Log it, even can’t duplicate
Step 2: Describe the Bug
 Both verbally and in writing
 To be as descriptive as possible
 Help you fix bug easier
 Describe bugs so other can
 understand them
Step 3: Always Assume
That the Bug Is Yours
 Most of bugs are your fault
 Only small % are result of compiler
 or operating system
 Check your code before looking for
 bug elsewhere
Step 4: Divide and
Conquer
 Start firming and testing your
 hypothesis
 Doing a little light debugging
 Reevaluate hypothesis and try again
 Debugging is like a binary search
 algorithm
 Update the bug description
Step 5: Think Creatively
 Looking at the bug from different
 perspectives
 Walk away from the problem for a
 day or two
Step 6: Leverage Tools
 Tools may help you find bug in
 minutes
 Run code through tools before any
 heavy debugging
Step 7: Start Heavy
Debugging
 Spending time exploring your
 application's operation
 Use the debugger's advanced
 features
 Never poke around with the
 debugger
 Double-checking the changes you
 made to fix the bug
Step 8: Verify That the Bug
Is Fixed
 Test, test, and retest the fix
 Test with all data conditions, good
 and bad
 Let the team know the changing
Step 9: Learn and Share
 Quickly summarize what you
 learned
 Learn what you did wrong
 Share the information with others
The Final Secret
 Ask debugger the right questions
 Have a hypothesis in mind
24mB Software Development



       http://www.24mb.com

Mais conteúdo relacionado

Último

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 

Último (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

Destaque

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destaque (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Debugging Application

  • 1. Debugging Applications Author: Tien Do 22-Dec-01 24mB Software Development
  • 2. What We Will Cover Defining the different types of bugs Learn how to write applications with fewer bugs in the first place Developing a proactive process for debugging that all great developers follow
  • 3. Today’s Agenda The gestalt of bug Avoid bug in the first place The proactive debugging process
  • 4. The Gestalt of Bug 24mB Software Development
  • 5. What Are Bugs? Inconsistent user interfaces Unmet expectations Poor performance Crashes or data corruption
  • 6. Process Bugs and Solutions Short or impossible deadlines The quot;code first, think laterquot; approach Misunderstood requirements Lack of knowledge Lack of commitment to quality
  • 7. Short or Impossible Deadlines Unrealistic schedules Underestimate how long to develop a solid product Leads to cut corners and a lower quality product Ship dates should be based on a feature set
  • 8. The “Code First, Think Laterquot; Approach Starts programming before they start thinking Very few like to write documents Introduce more bugs into an already unstable code The solution is simple: plan your projects
  • 9. Misunderstood Requirements Feature creep causes more bugs than almost anything else quot;paper prototypesquot; the user interface Really understand the products' requirements Spend adequate time to understand the problem domain
  • 10. Lack of Knowledge Don't understand the OS, the language, or the technology No one can be expected to know the ins and outs of everything Acknowledging the strengths and limitations Strengthening every developer's weaknesses
  • 11. Lack of Commitment To Quality The most serious problem Company's commitment sets the tone for the entire team Make code the most robust and extensible
  • 12. Avoid Bug In The First Place 24mB Software Development
  • 13. Planning for Debugging Think about debugging right from the beginning Plan for exactly what will change Adding a feature doesn't affect just the code Goes together with planning for testing Code should tell you where the bugs are
  • 14. Prerequisites to Debugging Know your project Know your language Know your technology Know your operating system Know your CPU
  • 15. Learning the Skill Set Study continually just to keep up The ultimate way to learn is by doing Look at other developers' code Never be afraid to ask others Read programming newsgroup
  • 16. Assert, Assert, Assert, and Assert The key proactive programming tool for debugging Using in addition to normal error checking Tell where and why a condition was invalid Serve as reminders to others
  • 17. How to Assert Should never change any variables or states of a application Check a single item at a time Strive to check the condition completely Assert against specific values Real error handling immediately follows the assertion
  • 18. What to Assert The parameters coming into a function The return values Any assumption
  • 19. Trace, Trace, Trace, and Trace Useful when used correctly with assertions Should associate with paths through the code Avoid putting trace statements inside tight loops Everyone uses a similar format
  • 20. Comment, Comment, Comment, and Comment The only way to make code maintainable Doesn’t mean duplicate the code Mean documenting assumptions, approach, and reasons Keep coordinated with the code Well-placed trace, assertions, and good naming conventions are also good comments
  • 21. Unit Testing Unit testing is how you verify yourself Writing unit tests as soon as writing code Run unit tests all the time during coding Code coverage Keep unit tests as part of the code base
  • 22. Bug Tracking Systems Track all the bugs of the project Keep notes and to-do lists in one place Better predict when your product will be ready to ship Hallmarks of a good software team
  • 23. Frequent Builds and Smoke Tests Build the application once a day Building both release and debug versions at the same time Build with the latest master sources Checks product's basic functionality Contain at least one test for every feature
  • 24. The Proactive Debugging Process 24mB Software Development
  • 26. Step 1: Duplicate the Bug The most critical step Sometimes difficult, or even impossible Try to get bugs through multiple paths Some bugs can mask others Log it, even can’t duplicate
  • 27. Step 2: Describe the Bug Both verbally and in writing To be as descriptive as possible Help you fix bug easier Describe bugs so other can understand them
  • 28. Step 3: Always Assume That the Bug Is Yours Most of bugs are your fault Only small % are result of compiler or operating system Check your code before looking for bug elsewhere
  • 29. Step 4: Divide and Conquer Start firming and testing your hypothesis Doing a little light debugging Reevaluate hypothesis and try again Debugging is like a binary search algorithm Update the bug description
  • 30. Step 5: Think Creatively Looking at the bug from different perspectives Walk away from the problem for a day or two
  • 31. Step 6: Leverage Tools Tools may help you find bug in minutes Run code through tools before any heavy debugging
  • 32. Step 7: Start Heavy Debugging Spending time exploring your application's operation Use the debugger's advanced features Never poke around with the debugger Double-checking the changes you made to fix the bug
  • 33. Step 8: Verify That the Bug Is Fixed Test, test, and retest the fix Test with all data conditions, good and bad Let the team know the changing
  • 34. Step 9: Learn and Share Quickly summarize what you learned Learn what you did wrong Share the information with others
  • 35. The Final Secret Ask debugger the right questions Have a hypothesis in mind
  • 36. 24mB Software Development http://www.24mb.com