Another way that has always worked for me in the last *gulp* 25 years of my programming carreer is to code by the twin principles of economy and elegance. There was a push several years ago toward the concept of "self commenting code", ie. code that would not have to be burdened by comments because the function would be evident by the way in which the code was written. This gave rise to OOP, among other practices.
The problem is that a language powerful enough to be self-documenting (like Perl) is also prone to over-economizing and obfuscation. When one gets so "elegant, cute, and economical" that you no longer understand what it was that you (or someone else) was supposed to be doing, one tends to patch, rather than fix.
It makes me wonder how many thousand lines of my code havee been commented out by those who came after? I'm sure I wouldn't understand what I was trying to say those twenty odd years ago. But you see, that's why we have powerful language constructs now, there's more than one way to do it. I agree that over commenting is a good way to make code more understandable and supportable, especially when it is necessary to streamline the code due to memory or clock tick concerns. There is a fine line between efficiency and obfuscation, and sometimes the comment is the only thing that saves you. But at the same time, I believe that the code should comment on itself, by being well written and understandable.
Of course, I have yet to see a self - documenting regexp. Commenting seems to be the only thing that works for me there.
Well this old man has rattled on long enough . . .
Simplicus
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.