views:

116

answers:

7
+2  Q: 

Debugger usage

Do you use the debugger of the language that you work in to step through code to understand what the code is doing, or do you find it easy to look at code written by someone else to figure out what is going on? I am talking about code written in C#, but it could be any language.

A: 

I will for particularly complex sections of code, but I hope that generally my fellow developers would have written code that is clear enough to follow without it.

Garry Shutler
+1  A: 

I use the unit tests for this.

krosenvold
A: 

Depending on who wrote the code, even a debugger doesn't help to understand how it works: I have a co-worker who prides himself on being able to get as much as possible done in every single line of code. This can lead to code that is often hard to read, let alone understand what it does in the long run.

Personally I always hope to find code as readable as the code I try to write.

feihtthief
A: 

I will mostly use debugger to setup breakpoints on exceptions.

That way I can execute any test or unit test I wrote, and still be able to be right where the code fails if any exception should occur.

VonC
A: 

I won't say I used all the time, but I do use it fairly often. The domain I work in is automation and controls. You often need the debugger to see the various internal states of the system. It is usually difficult to impossible to determine these simply from looking at code.

Jim C
A: 

Yes, but only as a last resort when there's no unit test coverage and the code is particularly hard to follow. Using the debugger to step through code is a time consuming process and one I don't find too fun. I tend to find myself using this technique a lot when trying to follow VBA code.

burnside
A: 

Yes, but generally only to investigate bugs that prove resistant to other methods.

I write embedded software, so running a debugger normally involves having to physically plug a debug module into the PCB under test, add/remove links, solder on a debug socket (if not already present), etc - hence why I try to avoid it if possible. Also, some older debugger hardware/software can be a bit flaky.

Steve Melnikoff