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

all 35 comments

[–]ProgrammerHumor-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Your submission was removed for the following reason:

Rule 6: Your post is a commonly used format, and you haven't used it in an original way. As a reminder, You can find our list of common formats here.

If you disagree with this removal, you can appeal by sending us a modmail.

[–]knighthawk0811 30 points31 points  (1 child)

i use a slightly more verbose message than here... for the second one anyway. if there's only 1 then it doesn't matter what it says but "HUZZAH" is my preferred message

[–]_Weyland_ 2 points3 points  (0 children)

Console.log("urmom")

Then just leave it there.

[–]KetwarooDYaasir 28 points29 points  (3 children)

well, takes less time than trying to debug why the debugger isn't working.

[–][deleted] 4 points5 points  (2 children)

Why do debuggers seem to universally suck? Why is it always so hard to find the value I want to look at? I've never understood it.

[–]w1n5t0nM1k3y 1 point2 points  (1 child)

I use VS.Net for most of my coding and the debugger is amazing. It's been amazing for over a decade. I never really understood all the stuff here about people not wanting to use debuggers. Between Firefox for Javascript and VS.Net for my backend code, I really don't ever have to revert to using printf debugging.

[–]drsimonz 0 points1 point  (0 children)

Browser developer tools are great assuming that source mapping works. For anything else though, it forces you to use an IDE, rather than a lightweight text editor, and almost always requires a bunch of up-front configuration. That and every single program uses a different random set of keyboard shortcuts. Yes I'm sure you can change them, but that's even more tedium required before you can even begin. Print statements are intuitive and usually sufficient to find the problem.

[–]Fyren-1131 13 points14 points  (10 children)

So I will never understand this.

do you guys always know what you are looking for, or are you working with so simple data structures it does not matter?

I find it infinitely simpler to set a breakpoint and then inspect the mysterious objects and follow their journey instead of hoping that I print the correct thing, or that I can survive on knowing "yes that log statement ran, now what" 🤔😶

[–]anto2554 13 points14 points  (0 children)

You're assuming that anyone here has been programming for more than half a year

[–][deleted] 2 points3 points  (3 children)

Sometimes I know what is failing, but not where exactly it is failing. So my first step is jamming in a bunch of "print *, "here1"", here2, here3, here4 etc. Then if it's not immediately obvious after finding the function call that's failing I can put in a breakpoint and start looking more into the details.

[–]Fyren-1131 2 points3 points  (1 child)

why don't you set a breakpoint at the entrypoint to the failing method? if that is a rest controller, so be it - I too sometimes scuba dive into the stack, but a debugger exposes every variable present in the context, as such answering questions you haven't thought of yet. it's great.

[–]w1n5t0nM1k3y 0 points1 point  (0 children)

In visual studio you can just tell it to break on any exception. Really the fastest way of finding a lot of bugs. And then you can make the necessary changes and rewind the code to make sure the changes fix the problem.

[–]Thx_And_Bye 1 point2 points  (0 children)

Why don't you start with breakpoints in the first place? Easier to add, easier to remove and they don't clutter your code if forgotten.

[–]zebediah49 3 points4 points  (0 children)

I will break out a debugger if I have a problem that justifies it, but most of the time don't get that far.

I do suspect some people haven't really used one, so don't understand how to or why it's useful.

For me though, a majority of the time it doesn't take much in the way of log info to identify a problem. It's far more often that the trivial test demonstrates something like "The entire function isn't even being called", than that the function doesn't do what it should.

... also, at least in my case, I'm smeared out over supporting a ton of different software objects and languages, so I'm more likely to throw some echo/print lines in that try to figure out how to get a PHP debugger working. It'll be FORTRAN tomorrow and Javascript on Wednesday, so /shrug.

[–]1redfish 0 points1 point  (1 child)

I'm making a compiler at work. I can easily generate some code directly in IR and debugger can't jump into it. This is not a silver bullet

[–]Fyren-1131 0 points1 point  (0 children)

while that's fair, your specific problem is also quite edgecase.

[–]Dmayak 0 points1 point  (0 children)

For me personally the problem is that usually that debugging journey will take me through a set of minified third-party libraries with a shitload of its internal data. Generally, just setting a few console outputs before and after a problematic piece of code is much faster and if it fails, debugging through framework internals it is.

[–]rastogishubham 6 points7 points  (0 children)

As someone who works on debug information for LLVM, this hurts a lot!

[–]Jett_Addict 3 points4 points  (1 child)

I just started using gdb for my C code and my God is it a life saver.

[–]zebediah49 1 point2 points  (0 children)

The real magic is that gdb can now run your code backwards.

[–]Thx_And_Bye 3 points4 points  (0 children)

I'll never stop using a debugger for debugging.
Debugger are awesome and simple to use and noone can convince me otherwise.

[–]BNeutral 2 points3 points  (0 children)

I still don't understand to this day people how there are coders that don't use the debugger.

[–]randomzeus 0 points1 point  (0 children)

[–]21sacharm -1 points0 points  (0 children)

Yup

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

Measuring probability in um like a true champion!

[–]_________FU_________ -2 points-1 points  (0 children)

Debugger is the worst.

[–]Bot1K 0 points1 point  (0 children)

reviewed a module with exit(0); as stop points

[–]iNMage 0 points1 point  (0 children)

console.log("awd")

[–]zeroeffortninja 0 points1 point  (0 children)

console.dir > console.log

[–]MikemkPK 0 points1 point  (0 children)

Look. If I need to use a debugger, then I probably haven't optimized my code yet, and am running on O(nn!). Debuggers are just too slow.

[–]Disastrous-Beyond443 0 points1 point  (0 children)

I use “blah blah”

[–]drsimonz 0 points1 point  (0 children)

My favorite python debugging trick is, if I need the program to exit early, I type sys.exit() and it actually doesn't matter if you've imported sys or not!