Debugging built poor
An original article by author
When you're a noob, programming is a matter of writing perfect instructions for the computer to execute. Computer do what you say, and we get results.
In the real world, you first meticulously construct a program, have the logic in place, character perfect and run.
It fails spectacularly.
At which point the real programming starts: debugging.
The smart ones simply let their program fail. In fact they don't even bother writing to the end. They put the program logic down in pseudo-code (which is often simpler than you anticipate), produce the first tiny slice of real code, run and see how creative the errors his compiler can come up with.
Depending on your level of programming maturity, seeing errors can either be physically crippling or intellectually stimulating.
print "lorem ipsum"
Say what you like; when situation calls for I like sprinkling debugging printing lines like that across my code and see where it stops. Primitive, but works across every language on every platform.
Along with block commenting.
But all too often, you don't get the privilege of seeing your own programming output in complicated environment. Even a simple AJAX request will trip you up, simply because you can't have your lorem ipsum displayed on your browser.
It gets worse when Javascript forces you to do event-driven programming.
When all else fail, we settle for an IDE that tells us everything they know about each variable. If you're up to it, maybe step through the flow.
But really what we're doing is we're begging the computer to give us more clues to what went wrong; and more variables means more red herring.
Modern programming languages still have the assumption that we know exactly what we're telling computer to do.
In business we've learn to repeat what the other guy just told us, just to be clear to each other about the message conveyed.
So how come we come to expect the computer to just accept what we told it?
How computer thinks
Perhaps what we need is to visualize how our program thinks. As soon as a line is written, draw me something that looks like a thought.
And when I run animate the thought, let me examine it and see if it makes sense.
Perhaps that has to be baked into a programming language or maybe not, I don't know. But the value of instant result can't be underestimated.
Until then, I just installed PHP Debug Bar into my app, hoping to give my debug echos just that bit of class.