Comments in and on Perl - a case for extreme OO programming
Archive - Originally posted on "The Horse's Mouth" - 2010-11-21 22:02:33 - Graham Ellis
"The only thing that will interpret Perl is a Perl interpreter" ... how those words rang in my ears this morning as I was writing some code to highlight source code comments in a different colour in our web site examples. The words were spoken by Larry Wall ... I think it was 10 years ago, so I may have paraphrased through the passage of time ... but when I was working on the site this morning, I came to realise again just how wise those words were. For the most part, the code I was working on works quite well - but there are a few examples where it doesn't - and it's interesting to note that those cases where it doesn't work are the Perl ones - with comments in languages like Lua being much cleaner in how the comments are identified.
I'm also looking back at my work, and thinking that I should have coded in a much more object oriented way, as what was intended to be just a short piece of code turned into something rather larger - and with so many conditions for different types of file that I now realise that I should have started with a base class, with files of exceptions for the derived classes. Perhaps I should use the extreme programming approach - take the work I did as a proof of concept, and refactor it.