Your SlideShare is downloading. ×
Debugging Application
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Debugging Application

908
views

Published on

This presentation was made in 2001 when I read favorite Debugging Application book of John Robin

This presentation was made in 2001 when I read favorite Debugging Application book of John Robin

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
908
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
32
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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
  • 25. The Steps Illustration
  • 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