DEV Community

Joonhyeok Ahn (Joon)
Joonhyeok Ahn (Joon)

Posted on

How not to create another bug while fixing one

Many developers make mistakes of making more bugs while trying to fix a bug. People will trust you more if you don't produce these unnecessary outcomes.

Here are 5 tips that I've learned over time

  1. Understand the root cause of the bug: Before you start fixing the bug, make sure you understand the root cause of the problem. This will help you to identify potential side effects of the fix. Any reports, logs, or system dashboard can be useful information.

  2. Write test cases: Before fixing the bug, write test cases that cover the problem. These test cases should be able to reproduce the bug and should also cover any related scenarios. After you have fixed the bug, run these test cases to verify that the bug has been fixed and that there are no new issues.

  3. Isolate changes: When fixing a bug, try to isolate the changes to the smallest possible area of code. This will help you to identify any potential issues that may arise from the changes you make. And if you are not sure what side effects your changes can make, try to communicate with other members first..!

  4. Review your code: Have someone else review your code before you merge it into the main codebase. A fresh set of eyes may identify issues that you missed. Even if you already covered the automated tests, running a quick manual test will never hurt.

  5. Monitor: After you have fixed the bug, monitor the application for any regressions. This involves checking that the fix did not introduce new issues. Again, any reports, logs, or system dashboard can be useful.

I was able to produce less bugs after I started applying these tactics to the daily workflow. So try these and become more reliable dev in your team!

If you like this content, please follow https://bitethecode.substack.com and https://github.com/bitethecode. I will try to share what I've learned with y'all!

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay