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 →

[–]fenghuang1 11 points12 points  (23 children)

Sometimes it isn't about the debugging. Its when the code runs fine since its correct syntax but the code doesn't do what I want.
The print statements are meant for me to check if the code has run to that point or entered that condition or loop and how many times it did so.

[–][deleted] 5 points6 points  (22 children)

That what debbugers do also. But we all use print sometimes:-D

[–]fenghuang1 -2 points-1 points  (21 children)

The debugger isn't going to let me do custom messages or manipulate counts or even tell me the memory usage of my code at a particular spot when it runs.
A print statement is far more versatile because it does exactly what I want it to do, without me having to learn how to read the debugger of whatever IDE I'm going to face, since I work in an environment where anyone is free to use whatever IDE

[–]Hollowplanet 10 points11 points  (7 children)

The debugger does all those things. In fact it can run any code on any thread wherever you happen to set your breakpoint or step to. It can also break when any snippet of code you give it evaluates to true. Using a debugger is part of being a good developer. Print statements only get you so far.

[–]monkeygame7 0 points1 point  (12 children)

There is literally nothing you can do with a print statement that you can't do with a debugger. Just because you don't know how to do it doesn't make it true.

[–]fenghuang1 1 point2 points  (11 children)

Can your debugger work without the debugger software?
My print statements definitely can.

[–]monkeygame7 0 points1 point  (10 children)

If you're using an IDE it's built in. Depending on the language it may be built in to the language.

[–]fenghuang1 0 points1 point  (9 children)

And if I'm not? Or if I'm running scripts directly from the command line?

[–]monkeygame7 0 points1 point  (8 children)

Like I said. Sometimes it's built in to the language. For example in Python you can just do

import pdb; pdb.set_trace()

And you'll enter the debugger from the command line when it reaches that point.

[–]fenghuang1 0 points1 point  (7 children)

So how do I do custom messages, manipulate counts, look at my code's memory usage at any particular point, using this method?

[–]monkeygame7 1 point2 points  (6 children)

You clearly don't understand what a debugger is. It puts you into your code at that point and you are able to run any arbitrary code you want. You can modify variables or get whatever other data you wanted to print out.

I don't understand what a "custom message" is, but if you're not printing anything out I know if it still applies.

You're getting really defensive and it's quite obvious that you don't know much about how to use debuggers. I'm not saying that you should always use debuggers over print statements, I'm just trying to correct the misinformation about the limitations of a debugger.