in reply to RE: My philosophy on coding (in Perl and other languages):
in thread My philosophy on coding (in Perl and other languages):

I actually just started reading the Pragmatic Programmer yesterday (got it from Fatbrain - and that wasn't a plug).

My only issue is with your statement: "Make the code its own comment. "
Since not everyone will use meaningful names when writing their code (I'm certain you have seen it too), I tend to think that comments are important. Now, I didn't mean comment every line - or even every 3rd line. I meant that (and I should probably have said) there should be a decent description for the subroutine and what(sometimes how) it does. After all, why do we have the '#' if we shouldn't use it?

Thanks for the feedback. It's good to know that people are actually reading what I post and taking the time to comment on it. :-)

Mick
  • Comment on RE: RE: My philosophy on coding (in Perl and other languages):

Replies are listed 'Best First'.
more philosiphizing...
by jlistf (Monk) on Aug 15, 2000 at 21:23 UTC
    philosiphising? does anyone know how to spell that word?

    anyway... my first programming teacher taught me that when you're commenting subroutines (or functions or methods) its usually a good idea to put in a 'precondition:' statement and a 'postcondition:' statement. in other words, tell the reader what the subroutine expects to recieve as arguments (including implicit error-checking perhaps) and what the subroutine will spit out as a return value.

    jeff
RE (tilly) 3: My philosophy on coding (in Perl and other languages):
by tilly (Archbishop) on Aug 16, 2000 at 00:06 UTC
    Well put it this way. If humans read a different document from the computer, you have a problem. The fact that there are programmers who do not understand how to code well is their problem. If you rely on such programmers and have put no thought into communicating your requirement that the code have decent quality, then their problem has become yours.

    Bad programmers are a hazard to your code-base. So give them feedback and review. Doing that up front saves energy in the end over letting it pass and cleaning up after. A stitch in time and all that.

    BTW I do comment most subroutines. Input arguments, brief description, and return. Often only the ones that are meant to be used outside the module though...