Tip #2 Step Through Every Line of Code in a Debugger

This is so simple.  The place where I catch most of my bugs -- before the code is even checked-in.  

Drum-roll:

Step Through Every Line of Code You Write in a Debugger

 I'm frequently amazed at what I bump into during this pass-through.  I've found all sorts of embarrassing problems.  You never see them, though, because I caught them before checking in.

Nobody writes bug-free code.  But you can check-in bug-free (or nearly so) code.

Some people may counter with: "Oh ho!  I have no time to step through the code in a debugger!"  My answer is that the time it takes to  step through the code in a debugger is normally a tiny percentage of the time it takes to do all of these things:

  • Think up what to write
  • Write it
  • Fix compile errors etc.
  • Fix more obvious errors from simple tests
  • write unit tests
  • write dev tests
  • close an issue in Issue Tracker
  • check-in comments
  • Ask for a code review, get comments, respond. make changes

And I mean every line of code.  Modern java debuggers allow you to change values of variables, etc., to force your execution path into error handling code.

If you start do this zealously it may force you into picking up other good development habits too, that make it easier to step-through all of your code.



Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

ByronNevins

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today