Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Re: Re: do/redo or for(;;): what's Kosher?

by Anonymous Monk
on Jan 04, 2002 at 18:41 UTC ( #136275=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: do/redo or for(;;): what's Kosher?
in thread do/redo or for(;;): what's Kosher?

Comments are evil.

It's not that you should not comment, for even evil things are necessary, but it is the duty of the good person to avoid doing evil where practical.

Comments are evil, because they can lie. Code does not lie, it is the ultimate presentation of the truth. Sometimes, the truth can be hard to understand, but it is not wrong, only obscured.

If you create your loop:

# while(1) { .. redo }

Then any maintainer or formatting program can come and change that comment, or the code it supports, with no effect on the functionality of the program. Your testing suite will continue to work, your users will notice no difference, and yet your program contains a lie. This lie can cause no end of grief down the road, as programmers read comments and code alike as the truth.

It is the duty of the programmer to convey the truth of the program, to both computer and maintainer alike. It is the duty of the language, to convey that truth to the computer in an efficient manner, and to the maintainer in a manner easy to understand. Do not take upon yourself the duty of the language without good cause, you will cause much suffering to the maintainer.


Comment on Re: Re: Re: Re: do/redo or for(;;): what's Kosher?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://136275]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2014-04-18 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (473 votes), past polls