r/ProgrammerHumor • • May 17 '21

Debugging is cool

Post image
62.2k Upvotes

464 comments sorted by

View all comments

16

u/[deleted] May 17 '21

The other day i spent 3 hours searching for a mistake on my code. There was none, I had forgotten to Output the damn thing in the console...

6

u/LoyalSage May 17 '21

First coding project I’d ever worked on at work, I had written a function in the morning and when I came back from lunch and tried running the program, it wasn’t doing what I expected. I kept debugging it all afternoon and got nowhere.

The next morning I came in with fresh eyes and started tracing through the logic. I scrolled down to where the function was called and thought, “Yeah, and then I call the function, passing in a and b.” (variable names were better than that, just don’t remember)

The line of code was kind of long (I think I was assigning the result of the function call to a nested property on an object, plus the function name was a bit long), so it went of the right side of the screen. I scrolled over, which I hadn’t done the previous day for whatever reason, and saw that I passed in null for both parameters.

I think I’d wanted to compile it before lunch to make sure the code at least compiled before I figured out what needed to be passed in to the function.