The Model-View-Controller (MVC) pattern separates an application into three components: The MVC pattern is an updated version of the old adage that computer programs come in three parts: input, processing, and output. It is a nice way to describe the high-level architecture of an application because Views and Models naturally separate form from content. Separating form from content usually leads to cleaner code and greater flexibility.

For a future web application, I am meditating on the best approach to take for the view and model. There are two general approaches I am looking at.

The first is a traditional perl templating scheme. The model would be a flat file or relational database, bound to a perl program through DBI. The view would consist of a set of template documents that would transform data to various formats (HTML, plain text, CSV, etc.) using, for example, Template::Toolkit.

The second approach is to build an XML application. The model stores data in an XML format and is accessed directly, or perhaps using XML::LibXML. The view would consist of a set of template documents that would transform data to various formats (HTML, plain text, CSV, etc.) using the XSLT language via, e.g., XML::LibXSLT.

I have little experience with either templating scheme, and I am seeking advice on the pros and cons of these two approaches. I understand that the subject of XML vs. relational databases is contentious. Let's assume that I am comfortable implementing either variety. and that the database will be small enough that performance considerations will not be foremost in the design. Also, if performance becomes a problem, I could create an XML wrapper around DBI results. So the comparison becomes that of a perl templating language vs. XSLT.

Some questions pertaining to the comparison are

-Mark


In reply to Model-View-Controller: Template Toolkit vs. XSLT by kvale

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.