Don't ask to ask, just ask | |
PerlMonks |
Re: IYHO, what do you consider good code?by logan (Curate) |
on Jun 13, 2003 at 04:31 UTC ( [id://265579]=note: print w/replies, xml ) | Need Help?? |
I have a unique problem as a coder. I have a lousy memory. Terrible. For some reason, I can remember the names of singles by obscure punk rock bands, but the proper placement of the comma in an open statement refuses to settle into my brain.
Frequently, I have to revisit code I wrote a year or more ago, and figure out what it does and why it isn't doing it anymore. Ergo, I'm comment guy. Each subroutine I write has a profile at the top something like this:
The essential concept is to insure that I won't have to spend a lot of time figuring out what a sub does. If I do something "clever", I put in comments explaining why. A few times, I've gone so far as to include the chapter in The Camel Book/Perl Cookbook where the concept was discussed. Also, if the main chunk of code is a loop, it helps to list the exit condition at the top. You might also find the Perl Programming guidelines/rules thread instructive.
-Logan
In Section
Seekers of Perl Wisdom
|
|