Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
For me, the writing of comments is part of the thinking process.

In effect, you are using prose as a form of pseudo-code.

In the past I've tried or used prose, Weiner-Orr Diagrams, Yourdan, SSADM (and derivitives), Jackson, UML, various flavours of Case, and half a dozen variants of pseudo-code to plan code and/or document it. Some with more or less success than others. But in the end, I've found that the language of implemetation is the best pseudo-code (for me!).

I'll often start by sketching out the skeleton of the algorithm in Perl-glish (or C-glish or whatever-glish), and then slowly refine that into code. The advantage is that even at the early stages, I can use the compiler or interpreter to check my progress. When the compiler stops complaining, I'm usually getting close.

it's not the most significant of the comments in a 2,800-odd line module.

Agreed. And it is perhaps a little unfair to pick out so few lines from so many, but to do more entails a lot of work. I did make a start on attempting to re-write the entire module in what I would consider to be a self-documenting style, but then realised it would be equally unfair, as I would be starting from the position of your working example. I also ran out of awake cycles.

The bottom line has to be that there is no 'one right way' to program. But historically, I've found that people tend to be even worse at writing good comments than they are at writing good code. The difference is that I have the compiler to help me sort out the code, but no assistance is available for comments. (Especially a problem for me if they are in German or Italian or Chinese or Spanglish :)

I've personally found it more efficient and effective to put a little more effort into chosing variable and function names that allow the code to be somewhat self-documenting, than to write everything twice. But I realise that that doesn't do it for everyone.

But I do take exception to the implication that my deliberate and considered preference for minimal commenting is born of laziness or a lack of consideration; as nothing could be further from the truth.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^6: Why no comments? by BrowserUk
in thread Why no comments? by targetsmart

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2024-04-23 08:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found