I have three words for you: Model, View, Controller. You want to split your application framework up such that it makes solid distinctions between these three categories of code.

Model refers to the underlying data in your system. It includes your classes that embody any and all collections/associations of data.

View refers to the various ways in which data is rendered either to users or other systems. It includes your filters, formatters, mungers, etc.

Controller refers to the mechanisms that mediate interactions between all players in the system, namely Users, the Model, and the View. It's job is to accept input from Users, load things from the Model, feed that stuff through the View, hand the result to Users, and repeat.

If you do a good job making these distinctions, then you will be able to plug the components of your system together in myriad unpredicted ways, making it highly flexible and extensible.

As an example, think of an Apache/mod_perl web application framework for delivering finance reports... The Model will consist of the classes that embody various financial thingies. The View will consist of the classes that accept things from the Model and format them into pretty HTML for PHBs to look at in Internet Exploiter. The Controller consists of the Apache handlers that parse the incoming URLs, load the requested objects, pipe them through the appropriate View classes, and then forward the results of the View to the User.


In reply to Re: Designing a thin interface by skyknight
in thread Designing a thin interface by shemp

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.