DEV Community

Discussion on: What do you do when you encounter a hard to fix bug?

Collapse
 
patricktingen profile image
Patrick Tingen

What a fantastic read, it would be worth a read as a stand alone article.

Clean it up
In addition, what I do to solve hard-to-find bugs, is to clean up the code. More often than not, the code is a mess with duplicate code, unneeded variable, wrong naming etc. Cleaning up gives me a chance to look differently at the source and sometimes - when your lucky - cleaning up actually solves the problem.

Tear it apart
Other option is to take out portions of the code and test them separately. When doing this, I often place the code back in its own function since it is more or less abstracted away from that point on.