http://www.perlmonks.org?node_id=58738


in reply to Tricking Our Egos


Thinking about it, i suppose that is a proper way to explain what is happening for a lot of programmers when they debug. Don't know if i qualify as a programmer but i usually try something like the following:

1) make every block of code simple and direct
A block of code can be a subroutine, a script, or sometimes just one line. Just make sure that that block does exactly what it says and no more (this usually requires double checking while writing the code)

2) when debugging, find the blocks of code that relate to the problem
Since we know that blocks of code only do their one thing (hopefully well), we can narrow it down to certain parts relatively quickly

3) Pat yourself on the back for the blocks of code that didn't cause a problem.
This is an ego boost for a job well done, at least on part of the code.

4) Triple check that your solution worked
This will assure that you will have less problems next time something goes wrong

5) Look for the next bug
It's probably in that block that didn't have an error last time, but now you can pat yourself on the back for a different piece of code.

Me thinks my main problem is that i will always assume there are unsolved bugs in my code, even when it's fully working, even if it's only one line. So patting myself on the back is a way to get myself to continue since i'll know that at least one piece of code is ok.

to each their own, TIMTOWTDI
jynx