Industry


Ads by TechWords

See your link here


Martin MC Brown's picture
Martin MC Brown

Computing From the Front Lines

Perl best practice

I love Perl, and I'm not afraid to admit it, but because it is such an easy to use language it is very easy to fall into some bad practices.

Damian Conway has written this excellent little guide to Perl best practices.

I don't agree with the order of what he suggests; mostly because I think most Perl programmers don't follow the model that would make it practical.

Top down development is great; mapping out and planning all of the different elements, but really, Perl makes it so easy to go bottom up and start adding features and functionality and then back-hack the system into a module and add testing and other bits that designing the module interface first is probably not going to work out the best way to go.

I'm not saying it's impossible, just simply unlikely!

The principle though is correct and the rest of the article should be required reading for all Perl programmers. I particularly like tip 2; building a test harness before the code not only means you can test quickly during development, but it also helps focus the mind so that you develop the code right, simply because you are making the code past the test rather than writing code that works and building a test afterwards.

If you like this kind of thing, then Damian has a book, Perl Best Practices which goes into even more detail. Another book to add to the shelf of 'Perl books that are required reading'.