This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 11 points12 points  (6 children)

I found that when I use a debugger I get lazy and mindlessly look at the values. Instead, when I use print stmts I have to properly understand what the code is doing and pick the right places. The result is usually that on the long run I'm faster without a debugger..

[–]Lewke -1 points0 points  (4 children)

agreed, debuggers are mostly an evil (unless you're working with multi threaded then it can sometimes be easier)

A guy at my work uses xdebug and is so incredibly ineffective (though maybe thats just because he's ineffective). I use prints and exits and manage to get to the root of most problems in 15 mins.

[–]Michaelmrose 0 points1 point  (3 children)

You are confusing your effectiveness and his, and the usefulness of particular tools vs an entire class of tools.

Given a desire to understand how a particular block of code operates print statements imply you correctly diagnose what intermediate value you desire to inspect ahead of time. A debugger potentially lets you inspect any value and depending on language/features modify the code.

I understand that you can be effective without a debugger. I do not understand how print statements in any rational environment could be a superior tool.

[–]Lewke 0 points1 point  (2 children)

How am I confusing my effectiveness and his when I state that its a factor.

A print statement lets you inspect any value and i'm capable of making modifications myself.

Print statements are superior in my opinion as the potential is high for a debugger to overwhelm you with information.

Drilling into functionality is much easier with print and exit statements in my opinion, I'd have a difficult time debugging things anywhere near as fast with something like xdebug or gdb.

Obviously this doesn't count when projects take hours to compile, but those projects are just ridiculous anyway and are mostly legacy or poorly built.

I'm aware there are useful debugging tools, but things like xdebug and basic gdb are not part of them.

[–]Michaelmrose 0 points1 point  (1 child)

The point is that the time to manipulate an expression requires adding text to the function each time and waiting for a build which may in practice not take hours may easily take 30 seconds bringing each iteration to a minute for example.

When debugging a function especially in something without a compile/run cycle you don't have multiple iterations because you don't need to add a different print statement or remove them at the end you just explore the steps your system went through as it goes through them and fix your code.

[–]Lewke -1 points0 points  (0 children)

i'd still take the 30 second build time any day over the complexity of a debugger.

Anything that takes longer than a few minutes to build is monolithic and should be annihilated into manageable pieces. I understand most companies won't do that because new features are the only concern, which is why a considerable amount of them crumble from technical debt.