Avoid the wheel being re-invented by using Perl modules
Archive - Originally posted on "The Horse's Mouth" - 2004-11-08 18:17:33 - Graham Ellis"Don't re-invent the wheel". Such is the underlying philosophy of programming - if you re-write a piece of code that's already been written and tested, you're probably wasting time that could also be better used. You're also likely to be creating a longer term support issue - someone's going to have to look after your code in the future.
Am I discouraging you from writing new code? Yes, if the code already exists. But no - there are still things to invent.
Having invented something, you should make it as easy as possible for others to find and use it:
* You should be writing your Perl code for distribution in classes /modules. That way, you can encapsulate the logic that you need within the class and provide a neat and short way for users and other programmers to make use of what you've written.
* You should be using the structure that's already been defined (and become something of a standard) to add your documentation, test routines and support files to your class; this will package it in a similar way to that in which it would be uploaded to the CPAN
* You should publicise your module well so that it can be found easily by anyone who searches for it, even if they don't know exactly what they're searching for.
Samples of files that make up a standard module are available on our web site and our Perl for Larger Projects course will be updated to include extra coverage on this topic before the next public run in December.
I'm giving a Perl course tomorrow, which is why I'm thinking Perl today - but the philosophy described here applies to PHP and the PEAR, Python and the Vaults of Parnassus [[ or now - the Cheeseshop ]] and elsewhere too.