My code is broken

…unless…

Most of the time it is (no offense): a simple programming mistake that happens to everyone, an obtuse language decision that needs a workaround, a framework that makes it needlessly complicated to do a simple thing… there are lots of issues people encounter on a regular basis that are just a fact of life.

That being said…

If you are using a small library, an experimental feature, an uncommon implementation, or some other edge case, you may have found a bug. This could also be the case if the issue magically appeared after an upgrade somewhere in your system.

I would recommend only investigating this if all of the above has failed you, because it’s usually seen as pretty rude to make a mistake in your program and then blame the software for your incompetence (again, no offense). But the following are signs that the issue could be out of your hands:

  • If you’re debugging and you find the error in some library code
  • If the code works correctly in a different environment (e.g. Jetty vs Tomcat, Windows vs Linux, etc)
  • If everything behaves when using one version of a library but breaks on another

If this is the case, definitely make sure you’re running the latest version of the library in question! No sense bugging people about an issue that’s already been fixed!

If the issue is still there, try opening a ticket in the project’s issue tracker. Be sure to post a link to your original question if it’s in a public space so they’re aware that you aren’t offloading your problems to them and that you’re trying to fix this. Accordingly, edit your question to have a backlink to the issue you opened: it’ll keep people reading your question from opening up another one on your behalf. This post should be simple and to the point: list your language name/version, library version, any other important information (operating system, other libraries, etc), and the steps needed to reproduce the issue (preferably with code and expected/actual output).

Once again I should stress this: this is a last resort! Pestering maintainers with your problems is a bad thing, and should be done with great restraint! But if there’s an issue with their code, they should know about it so they can fix it and keep other people from dealing with the same annoyance you did.

To summarize…

  • Try to properly define the problem. “My code is broken” means nothing.
  • Make a good effort to find out what’s wrong. Debugging, printing values, and reading error logs are all good ways to find out what’s happening under the hood.
  • Search for answers! It’s likely someone else has solved this already.
  • Know how to ask a good question. This will save everyone the hassle of asking “have you tried this…” over and over.
  • If all else fails, and the issue can be narrowed down to a specific tool or library, file a bug report. It might be an issue on their end.

Hopefully this has helped someone! Remember, we’ve all asked dumb questions at one point, and we’ve all made stupid mistakes. It’s nothing to be embarrassed about; it’s just part of becoming a better developer!

Leave a Reply

Your email address will not be published. Required fields are marked *