Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Debugging
John Graham-Cumming
September 2013
Ada Lovelace (1840s)
Maurice Wilkes (1950s)
 As soon as we started programming,
we found to our surprise that it wasn't
as easy to get program...
Writing code is hard
 But writing bugs is easy!
 Everyone does it all the time without
even thinking about it.
 Estimat...
Programmer
 If a person who debugs code is a
debugger than a person who writes
the bugs must be a... bugger?
Always have a fighter pilot in
your presentation
Colonel John Boyd
OODA Loop
THE GREATEST
DEBUGGER YOU WILL
EVER USE IS IN YOUR
HEAD
Ignore your tools!
ESSENTIAL SKILL: RUN
CODE IN YOUR HEAD
RISE
 Reproduce
 Isolate
 Target
 Excise
Reproduce
Isolate
 Tighten the OODA loop
◦ The smallest
◦ Fastest
◦ Most easily repeated
 And automate it
 Then turn it into a te...
Target
ESSENTIAL SKILL:
ALWAYS BE ASKING
WHY
Debugging Christmas Lights
ESSENTIAL SKILL:
DOUBTING
Excise
 Fix the bug
 Don’t introduce new bugs!
 You can check this with the test case
that you made earlier
Talk to the teddy
Look Around Debugging
 Where there’s smoke...
 ... research shows that bugs tend to
cluster
 When you fix a bug look fo...
5 bugs in a single line
dir.permissions = 666; // Make the file writable
 Bug 1: updates permissions without
asking
 Bug...
Remember This One Thing!
 The most effective debugging tools
are: your brain, a unit test, and the
print statement.
Upcoming SlideShare
Loading in …5
×

Software Debugging for High-altitude Balloons

5,550 views

Published on

A talk I gave at the UKHAS 2013 conference on software debugging.

Published in: Technology, Health & Medicine
  • Be the first to comment

Software Debugging for High-altitude Balloons

  1. 1. Debugging John Graham-Cumming September 2013
  2. 2. Ada Lovelace (1840s)
  3. 3. Maurice Wilkes (1950s)  As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.
  4. 4. Writing code is hard  But writing bugs is easy!  Everyone does it all the time without even thinking about it.  Estimates in GOOD code there are 2 to 4 defects per 1,000 lines  You’re not that good  You will spend many hours debugging
  5. 5. Programmer  If a person who debugs code is a debugger than a person who writes the bugs must be a... bugger?
  6. 6. Always have a fighter pilot in your presentation
  7. 7. Colonel John Boyd
  8. 8. OODA Loop
  9. 9. THE GREATEST DEBUGGER YOU WILL EVER USE IS IN YOUR HEAD Ignore your tools!
  10. 10. ESSENTIAL SKILL: RUN CODE IN YOUR HEAD
  11. 11. RISE  Reproduce  Isolate  Target  Excise
  12. 12. Reproduce
  13. 13. Isolate  Tighten the OODA loop ◦ The smallest ◦ Fastest ◦ Most easily repeated  And automate it  Then turn it into a test case
  14. 14. Target
  15. 15. ESSENTIAL SKILL: ALWAYS BE ASKING WHY
  16. 16. Debugging Christmas Lights
  17. 17. ESSENTIAL SKILL: DOUBTING
  18. 18. Excise  Fix the bug  Don’t introduce new bugs!  You can check this with the test case that you made earlier
  19. 19. Talk to the teddy
  20. 20. Look Around Debugging  Where there’s smoke...  ... research shows that bugs tend to cluster  When you fix a bug look for more in the same spot.
  21. 21. 5 bugs in a single line dir.permissions = 666; // Make the file writable  Bug 1: updates permissions without asking  Bug 2: doesn’t make the file writable  Bug 3: creates security hole  Bug 4: used decimal not octal  Bug 5: comment is incorrect
  22. 22. Remember This One Thing!  The most effective debugging tools are: your brain, a unit test, and the print statement.

×