Yeah I'm going to have to agree with them for the most part.
This is fine for a quick "Does it hit this line?" or "What is the value of this one thing?" But from there you need more diagnostics. What caused that value? Now that I know this value, what are the values of these other things, how many times is this gonna loop, why didn't this thing evaluate to true? You might have all of those questions sequentially, and will have to run your program again and again and AGAIN. But if you had a break point, and used your debugger, you could have figured it out in one run. You could have used the console to evaluate some operations on the variable x + 2 is "12" instead of 3 because x is a string, oops. Its easier to see types and things using the debugger than using print.
I agree with you... in some cases like doing queries and digging through each the vars in the hierarchy, it's much faster to debug.
But, for checking the type, one simply can just print(type(x)) aside from the fact that exceptions show clearly what happened when you add two different types in python :D
But using the debugger as a frequent used tool is just time consuming.
That works in python, but for other langs it won't. In addition the debugger should not be any more time consuming than the print statement. Add the break point and run the program, you have to type the print and run the program anyways. If its too hard then you have some other problem in your workflow to work out. You also run the risk of forgotten print statements and logging. enough of those especially in a loop can absolute MURDER performance. Print statements for debugging are no faster than debugging, but they are more dangerous.
In addition the debugger should not be any more time consuming than the print statement
I developed recently in django and spinning the debugger takes more time than printing and re-running the app.
It always depends, sometime running the shell and trying things out there is really much faster.
Print statements for debugging are no faster than debugging, but they are more dangerous
When you try this stuff in Android development (esp. Xamarin Android), you will change this line :D
enough of those especially in a loop can absolute MURDER performance
Generally you won't test a loop or an algorithm by hand / debugger, you would write logical tests against it... and run those tests till you get green ;)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I still remember once I said in reddit:
I got lots of negative attitude like:
Heck yeah... I generally use
Console.WriteLine
orprint
for debugging my apps!To make finding the printed line easier for me (say I wanna see the value of x), I do something like:
So I'm gonna search for the word "koko" in the output, and the next line should be
x
:DYeah I'm going to have to agree with them for the most part.
This is fine for a quick "Does it hit this line?" or "What is the value of this one thing?" But from there you need more diagnostics. What caused that value? Now that I know this value, what are the values of these other things, how many times is this gonna loop, why didn't this thing evaluate to true? You might have all of those questions sequentially, and will have to run your program again and again and AGAIN. But if you had a break point, and used your debugger, you could have figured it out in one run. You could have used the console to evaluate some operations on the variable
x + 2
is"12"
instead of3
because x is a string, oops. Its easier to see types and things using the debugger than using print.I agree with you... in some cases like doing queries and digging through each the vars in the hierarchy, it's much faster to debug.
But, for checking the type, one simply can just
print(type(x))
aside from the fact that exceptions show clearly what happened when you add two different types in python :DBut using the debugger as a frequent used tool is just time consuming.
That works in python, but for other langs it won't. In addition the debugger should not be any more time consuming than the print statement. Add the break point and run the program, you have to type the print and run the program anyways. If its too hard then you have some other problem in your workflow to work out. You also run the risk of forgotten print statements and logging. enough of those especially in a loop can absolute MURDER performance. Print statements for debugging are no faster than debugging, but they are more dangerous.
I developed recently in django and spinning the debugger takes more time than printing and re-running the app.
It always depends, sometime running the shell and trying things out there is really much faster.
When you try this stuff in Android development (esp. Xamarin Android), you will change this line :D
Generally you won't test a loop or an algorithm by hand / debugger, you would write logical tests against it... and run those tests till you get green ;)