in reply to Re: Code for readablity or fewer lines?
in thread Code for readablity or fewer lines?

I'll second that footpad, coding for clarity is best. People time is more expensive than machine time, and the divergence between the two gets wider every day.

Optimization is good to the point where code starts to lose clarity. Unless the application has to be really optimized. It optimization is the case, then add copius comments so when you or someone else comes back a year later to enhance or fix it - again people time.

I also agree, that I like to over-comment. A year from now I want to know what I was thinking when I go back and look at my code. Besides, comments don't add anything to the actual executable, they are discarded at compile time.

Mike - mps@discomsys.com

"The two most common elements in the universe are hydrogen... and stupidity."
Harlan Ellison

  • Comment on Re: Re: Code for readablity or fewer lines?

Replies are listed 'Best First'.
Re: Re: Re: Code for readablity or fewer lines?
by howard40 (Beadle) on Feb 28, 2001 at 02:54 UTC
    People time is more valuble than machine time.
    hehe ... that seems to be the driving motto of perl... :)

    if we were all hell-bent on maximum performance, most of us wouldnt be using perl at all but rather assembly or some language of that sort.

    i agree with you, readability almost always wins out over line count in my programs, however, dont mistake line count for efficiency line count doesnt always indicate a slower/worse script... sometimes adding a few lines into a script can substantially speed it up.