[geeks] Perl quality control

David Cantrell geeks at sunhelp.org
Sun Jul 22 14:29:44 CDT 2001


Plenty of people have bemoaned the poor quality of much of the perl code
that is in the wild.  Guess what.  The average chunk of perl code is
just as shit as the average chunk of C or python or Lisp or other
language of choice.

Yes, I know I was one of those pointing this out myself.  Because some
people seem to think that if code is published online, it must have
been vetted.  I wouldn't want anyone to go rushing off to CPAN expecting
to find the Holy Grail.

When *I'm* writing code for other peoples' consumption - whether it be
perl or anything else, and whether it be an application, a CGI script
or a module - I first write the documentation.  I then write a test
suite to conform to the documentation.  Then I write the code.  Cuts
down on bugs and means my code is far better documented than if I did
things the other way round.  Sure, I will *occasionally* revise the
docs and the tests if I see that I've promised to do something really
stupid.

FWIW, my current module project has [counts] 372 tests.  There are
about 600 lines of documentation and half that of code.  About half the
tests pass so far, and I am confident that the functions I have completed
will behave as documented under all conditions.

--=20
David Cantrell | david at cantrell.org.uk | http://www.cantrell.org.uk/david

Do not be afraid of cooking, as your ingredients will know and misbehave
   -- Fergus Henderson



More information about the geeks mailing list