Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Repeatedly trying solutions to see if they work isn't the optimal method for fixing bugs. Whenever I find myself doing that, I know that I need to stop what I'm doing and come up with a better plan.

If you take the time to understand the problem first -- run test cases to narrow down the precise conditions under which the bug occurs, read the code, step through the code with the debugger, etc. -- you'll spend less time trying and rejecting random solutions because you'll already have a good idea of what you need to do to fix the bug.

Another advantage of getting a good understanding of the code and the bug before fixing it is that it makes it much more likely that you'll actually fix the bug, and not some limited subset of it.



When I'm tired and/or lazy I seem to lack a ability to accept the truth. I seek for easy solution instead of actually doing what I already know I supposed to do. Luckily nowadays I am able to recognize this and call it a day.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: