Tuesday, June 28, 2011

Why Template::Toolkit is bad - Component Based Design

Many people like Template::Toolkit and I see it's use a lot in Perl based websites. But I think that it is a bad design practice. In the past I've used Template driven design, where for each view I generate templates.

This works well to start with - but then if you want to tweak every table on the site or every tab panel you need to go in and change every set of templates - now I use "Component Based Design".

Components can be:

  • "structural":
    • Tables;
    • Tabbed panels;
    • Two-col definition lists;
    • Forms;
  • "inline elements":
    • "Protecting" Email addresses;
    • "Abbreviated" URL links (http://Xxx ... adsa/page.html);
    • Citations;
  • "Simple blocks":
    • Captioned (and floated) images;
    • Pull quotes;
    • Marked up HTML/Perl/JavaScript;
    • YouTube embedded videos;
  • "Complex blocks/applications":
    • References;
    • Image galleries;
By generating the HTML using perl code it is easy to tweak the way all components are displayed in one fowl swoop... By keeping the markup clean the look and feel (what the designer has to make look good) is done entirely in CSS, and functionality is driven in Perl.... far far better than the template culture!

No comments:

Post a Comment

Note: only a member of this blog may post a comment.