If in doubt refactor

I am not through with it yet but it seems my estimate of fixing this last bug might have been accurate after all. I wasn’t even debugging. When I started writing the unit test for the class I am debugging (yes write tests first, but that one is too late for this project), I noticed how ugly that class was and started rewriting some of the code and structuring it for readability. Then I finally made a class to get rid of that seconds timestamp problem I have been having.

I thought I had eliminated that bug.

When I thought I was done with the refactoring there was one last error message: and guess what the bug was still there because I had forgotten to use seconds in one place. But of course when the timestamp no longer was a long variable but a class wrapping it, I noticed, and that’s probably what screwed up everything since friday (now that sounds worse than it is because I was on a short 4 day vacation since then).

I should really be more thorough when fixing bugs.

By Yashima

Writer of code and stories