I've moved from "comment the hell out of everything" to "write obvious code and document interfaces and data" over the past six months or so (yay code review!). It took me about three years to get from "comments aren't really necessary" to "comment the hell out of everything".

When I started working at Advanis, I'd document every block, and often every non-trivial line of code. The other programmers who looked over my code objected, saying that instead of writing comments, I should be writing more lucid code. I scorned them: good names are difficult to come by. They warned me that lengthy comments concerning the "what" and the "how" would quickly become obsolete and misleading. I scorned them: I saw myself as a disciplined, meticulous programmer who would never let that happen.

You've all seen this coming: about a month later, during one of my code reviews (arrogant and obstinate though I was, I wasn't dumb enough to spurn code reviews) with one of my block comments circled in scary red ink. The comment was completely at odds with the code (which I'd changed in a hurry during a rather stressful evening debugging run). And the student was enlightened.

My current project is a large module (large relative to the other ones that I've written) that I hope will appear on CPAN someday. My current approach to documentation is to describe the interface to each function in POD immediately above the function: this takes care of user and programmer documentation all at once, and involves less repeating of information. (And it seems that I'm finally starting to understand what Pike meant when he said "put the complexity in the data, not the code", so the code's simple enough that it shouldn't need documenting... but that's for a code review or three to determine, I guess.) We'll see how well that works.

--
:wq


In reply to Re: Why I'm a Pod::Nazi by FoxtrotUniform
in thread Why I'm a Pod::Nazi by Bobcat

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.