Hi and welcome!

Bugs hunting. Best practices. 09-10-2014


So you found a bug…

Sorry guys for maybe not very correct post title. This story will be not actually about bugs hunting, but mostly about that to do after you found the bug.

So you found a bug or got 500 Server Error exception. This is your project, but you are not only person working on it. What you should and should not to do?

Rule 1 Do not copy/paste exception to team chat immediately!

This is really bad tone. Instead try to track the exact place where exception was born. In most cases it will be really easy.

Now look around. Do you understand that caused the exception? Can you fix it quickly and you are confident your fix will be correct? Super!

Rule 2 Go ahead and just fix it!

If you are not confident or you do not understand that happened, check commits history and find the person who last worked on this code. Contact that person and show him the problem. Ask him for help in resolving. In 99% times the person, if this is really his bug, will re-take the bug from you and will fix it himself.

You see, you do not need to paste the exception in team chat in most cases.

There are only 3 excuses to do this:

  1. This is a critical production bug and you need immediate attention and help.

  2. You can not locate the person responsible for the bug.

  3. You have a solution for the bug and you want to show your team this problem as example of that can happen and how to avoid it. So if the bug can help someone in the team better understand the system and prevent similar bugs in future, then you should paste it in team chat with explanation.

And last but not least. About copying exception for pasting to the chat.

Rule 3 Text of exception should clearly highlight the problem and point to the place exception happened.

So if there is a SQL syntax exception, do not paste just plain SQL, but also include stack trace of DAO or Service method which calls this SQL.

You may want to paste the full stack trace just to be sure you have included all that is important. Do not do this!

If you are Java guy, then you know Java stack traces can be very, very long and meaningless. So just do not paste all this proxy/filter chaining methods. Look at the bottom of the stack trace. Usually the helpful part can be found there.

So do not disturb your team with super easy to fix NPE. Do not point to someone’s mistake publicly and loudly - people hate this.

And happy hunting!