Ayao "Alqualos" Kuroyuki (ayao) wrote,
Ayao "Alqualos" Kuroyuki

To debug or to delete?

Joel Spolsky is a very good programmer that writeth very good articles.

Eric Steven Raymond is another very good programmer that wrote magnificent book The Art of Unix Programming, which thou probably got tired to hear from me about.

On top of that, Joel refereth in one of his articles to this book and recommendeth it.

So far, nothing is wrong. But Joel writeth that one should never throw away any written code while Eric sayeth: "Don't hesitate to throw away the clumsy parts and rebuild them". That is exactly opposite. But why? What should one really do when they think their code is a mess? Throw it away and rewrite or bear with it and debug it?

The answer is that in properly designed software it is actually the same thing. Eric writeth, "The most powerful optimization tool in existence may be the delete key". I can say the same thing about debugging. The most effective way to debug something is probably to delete the whole thing containing bugs. But hey, stop! If we could simply delete it why have we developed it in the first place? Is not it better to just throw away the entire PC then? ^_^ No, what I am talking about is a little bit different. In fact, if thou noticed not, I have not told thee what this "whole thing" is. The trick is that in properly designed software there is a set of independent modules. Each module should be small enough to easily debug it or throw it away and rewrite from scratch if it is too much of a mess. So, this module is our "whole thing" or "clumsy part" which Eric refereth to.

What Joel says is that thou shalt not throw away the whole project. But if thy project is small enough to be thrown away without great harm, just do it. Consider it debugging ^_^. Thou just have to learn how to know when this debugging technique is most effective and when it is not. Only experience will teach thee that.
Tags: devel, it
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded