Re: Normalized Numbers
| From: | Robert Cummings | Date: | Fri, 12 Jan 2007 13:55:55 +0000 |
| Subject: | Re: Normalized Numbers | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246994@lists.php.net to get a copy of this message | ||
On Fri, 2007-01-12 at 14:40 +0000, Roman Neuhauser wrote:
>
> I know it sounds crazy, but (most) comments are evil. Comments are are
> excuses for better code, they're often no more than a vague repetition
> of what the code says. If the code doesn't describe what it's doing
> while it's doing it, then the code should be fixed.
Amen.
There are not that many cases were comments are actually useful.
Generally when necessary they give a brief summary of what is intended
or they clarify ambiguity or specialized techniques. Well chosen
variable and function names cause the code to practically comment
itself.
I think the discipline of using longer and more descriptive
variable/function/class names is far more helpful than commenting every
second line of code with the obvious.
> > 2 // check if th function was passed only a single character
> > 3 if(1==strlen($cd)) {
Ummm, DUH! :)
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'