Bye bye, reinvented wheel

dws on 2003-03-04T22:34:23

Today I bid a fond farewell to templating code that I wrote several years back on a flight from Albuquerque to San Diego, and debugging while sitting on the floor of the San Diego airport (plugged into one of the few plugs I could find) while waiting for a connecting flight to San Jose. At that time, the alternatives didn't seem to be there. That story has long since changed. Over the past two years, I've converted most of the code that uses my templating engine over to Text::Template or HTML::Template. Today, the last little bit went away. Bye bye.

It was on a previous connecting flight, sitting in the same place, plugged into the same plug, that one of the benefits of unit testing whacked me on the head. I'd written a bunch of formatting translation code "at altitude". Commercial airlines are pressurized to an effective altitude of 7000-8000 feet above sea level. If you're not used to that altitude, and are already tired after a long day, it's not the best time to be slinging code. I kind of knew that, but seemed to be on a creative roll. But on plugging in at San Diego and running the unit tests, it quickly became evident that the best course would be to throw all of the new code away and start over. Without those unit tests, or with fewer tests, I'd have burned up a lot of debugging time trying to protect a dubious investment.

And for what it matters, you can roast coffee beans in a hot-air popcorn popper.


The joy of throwing away reinvented wheels

Adrian on 2003-03-04T23:26:36

Ahh - I still get a warm glow when I recall the replacement of a hand-rolled templating system that I evolved over several years with Template Toolkit.

Cleaner, leaner code - and no more maintainence for the templating code. Serious warm fuzzies.

Home Grown Templating Systems

vek on 2003-03-06T02:52:35

Ah yes, the ol' home grown templating system. I was at OSCON 2001 and Perrin Harkins gave a 'choosing a templating system' talk. As I recall the first thing he asked us was something like "Ok, hands up, how many of you have written a templating system?". I would say about 90% of the audience raised their hand - myself included.

I seem to remember someone saying that writing a templating system was a Perl rite of passage. I can't remember who said it or where I read it though :-)