DEV Community

Discussion on: What's the dumbest bug you caused yourself

Collapse
 
jballanc profile image
Joshua Ballanco

The biggest face-palm bug I've faced was while working on a language runtime. I was implementing a method aliasing feature that, if working correctly, would extract a method from one object and inject it into another. I coded up a solution that should have worked, fired up a REPL, and attempted to hit the new aliased method.

I was promptly greeted by an error with the message "This method does not exist." Crud!

I went back and reviewed my implementation. I tried adjusting some things, moving allocations and dereferencing pointers slightly differently, and yet each time I got the same answer: "This method does not exist." I put in some debug logging statements, but everything looked correct. I stepped through the whole process in a debugger, and still everything looked correct.

At a loss, I randomly decided to look at the implementation of the method I was attempting to alias. Since it was a library method, and not part of the project I was working on, I had to go check out the code and dig in. Eventually, after working out all the complex inheritance and class-cluster implementation details, I found the source of the specific method I was working with. It was, in effect:

fprintf(stderr, "This method does not exist.");
Collapse
 
alephnaught2tog profile image
Max Cerrina • Edited

I just laughed so hard I woke the dog up.

My project for PHP this past semester was a site to track my errors with the idea that eventually you could have multiple users, share them, think of things to look for in your own code, learn, etc. I hadn't thought about the debugging issues that would arise when my code and text was full of the word "error" and oh man, the number of times I would stare at the screen because of the error message that showed up... only to realize that no, that WAS what was supposed to happen, I was TRYING to show those error messages.

Eventually I just added a temporary class to make all of those "error" messages bright green.