in reply to What is your practice for code documentation?

My experience with auto-generated docs has been generally poor. Auto-generated docs lack "narrative flow" and often don't have any useful summary information. In my experience the most useful part of most module's docs on CPAN is the SYNOPSIS section, which gives a brief example of the usage of each method or function. For example:

DBI.pm#SYNOPSIS

In a single page you've got pretty much everything you need to effectively use the DBI interface, laid out intelligently showing the basic groupings of methods. You'd need a pretty impressive AI to auto-generate that!

-sam

  • Comment on Re: What is your practice for code documentation?

Replies are listed 'Best First'.
Re^2: What is your practice for code documentation? (Test::Synopsis)
by lodin (Hermit) on Jun 27, 2008 at 19:37 UTC
    Indeed, the synopsis is extremely valuable. Unfortunately many people leave out a very important part: the result of the code displayed. In my modules I use the same format as I use on PM code examples:
    CODE __END__ OUTPUT
    For instance, the synopsis in List::Extract would be near useless if it wasn't for the output.

    It's easy to generate (and manually test) this by simply typing perl -Mstrict -w and then pasting the code. On your screen you now have the code, __END__, and the output following that, ready to be copied back.

    But the module may change, and an important feature of this format is that it's easy to test it. I've written, but not released, Test::Synopsis which extracts the code from the POD, compiles it, and if there were no errors or warnings, the output is compared to what's after __END__ (if anything).

    It has proven to be useful to me. I'm considering it for release.

    lodin