Thomas wrote:
> If you are
> learning C/C++, the ability to step through code line by 
> line and see
> what is wrong is invaluable.

I have to disagree with this. IMO reliance on a debugger, 
especially by beginners, encourages sloppy thinking, poor 
understanding, and suck-it-and-see coding practices.

Data structures and algorithms should be carefully planned 
before the coding starts, away from the keyboard. Writing 
pseudocode or even real code with a pencil and paper will 
eliminate most bugs before they have a chance to arise, 
because one is forced to understand the details of what 
one's doing. It should be possible to step through the code 
line by line in one's head or with the aid of a pencil and 
paper. If the code or data structures are too complex for 
this to be possible, some refactoring is necessary (KISS).

Bugs only occur because we, the coders, put them there. If 
we're unclear about what we're telling the computer to do, 
we need to sort things out in our own head.

Of course there are times when a debugger is necessary, but 
usually this is for advanced work, not beginners' exercises. 
One can go a very long way without ever using a debugger.

Personally I can't remember the last time I used a debugger. 
But I'm sure there must be people who use them every day and 
would be lost without them. So tell me why I'm wrong!  ;-)

David 

Reply via email to