Henri Icarus has asked for the wisdom of the Perl Monks concerning the following question:
Now I don't know about you all, but I've tried to do this and, but invariably I end up needing to add another parameter, or change the result to be a list (or a reference) so that I can pass back multiple results, and then, (call me lazy :-) I forget to update my little comment block at the begining of subroutine. So later when I go back (or heaven forbid someone else does) to look at this subroutine and I read the comments, and I look at the code, and I'm worse off than if I hadn't commented it because things don't match.
So, lately I've just been sticking to things like:
# foo: reasonably general description of what foo does sub foo { my $detailed_parameter_variable_name = shift; my $another_detailed_parameter_variable_name = shift; my $return_value_ref = {}; #hash of values to return ... return $return_value_ref; }
So the wisdom I'm looking for is what others have found to be the most effective use of commenting time and coding style to maximize "self-documenting" of the code.
-I went outside... and then I came back in!!!!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: The difficulties of commenting code
by damian1301 (Curate) on Jun 29, 2001 at 02:49 UTC | |
Re: The difficulties of commenting code
by voyager (Friar) on Jun 29, 2001 at 06:02 UTC | |
Re: The difficulties of commenting code
by eejack (Hermit) on Jun 29, 2001 at 07:32 UTC | |
Re (tilly) 1: The difficulties of commenting code
by tilly (Archbishop) on Jun 29, 2001 at 13:51 UTC | |
Re: The difficulties of commenting code
by dthacker (Deacon) on Jun 29, 2001 at 08:43 UTC | |
Re: The difficulties of commenting code
by pmas (Hermit) on Jun 29, 2001 at 17:19 UTC | |
Re: The difficulties of commenting code
by andreychek (Parson) on Jun 29, 2001 at 21:53 UTC | |
by Henri Icarus (Beadle) on Jun 30, 2001 at 01:14 UTC |