From ac92533bb5ff5349e1936128d889e7a181dd224c Mon Sep 17 00:00:00 2001 From: David Baird Date: Tue, 8 Nov 2005 12:24:59 +0000 Subject: [PATCH] Added a description of Presentation Model to Manual/Terminology.pod git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@420 48953598-375a-da11-a14b-00016c27c3ee --- lib/Maypole.pm | 2 +- lib/Maypole/Manual/Terminology.pod | 38 ++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/lib/Maypole.pm b/lib/Maypole.pm index b84360c..8fead4d 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -210,7 +210,7 @@ __PACKAGE__->init_done(0); As a framework, Maypole provides a number of B - methods that are intended to be overridden. Some of these methods come with useful default -behaviour, others do nothing by default. Likely hooks include: +behaviour, others do nothing by default. Hooks include: Class methods ------------- diff --git a/lib/Maypole/Manual/Terminology.pod b/lib/Maypole/Manual/Terminology.pod index 1871910..3e9a53a 100644 --- a/lib/Maypole/Manual/Terminology.pod +++ b/lib/Maypole/Manual/Terminology.pod @@ -30,9 +30,9 @@ Maypole. =item application -Sometimes this is used to refer to the driver, but this term is best reserved -to refer to the complete application, i.e. driver, plugins, templates, model, -the whole shebang. +Sometimes this is used to refer to the driver, or the driver plus configuration +data, but this term is best reserved to refer to the complete application, i.e. +driver, plugins, templates, model, config, the whole shebang. =item frontend @@ -99,9 +99,7 @@ be added easily. =head2 MVC and Maypole -=over 4 - -=item MVC - Model-View-Controller +=head3 MVC - Model-View-Controller A pattern describing separation of concerns in a complex application. The C represents the domain or business logic. The C represents the @@ -111,6 +109,8 @@ Opinions vary between how closely Maypole adheres to this pattern. Here's one opinion: +=over 4 + =item controller An abstract concept in Maypole, i.e. there is no specific controller class. @@ -152,22 +152,36 @@ model. Without this distinction, developers may add domain-specific code to the Maypole model classes, ending up with two separate code bases intermingled within one set of files. -To a certain extent, this is fine. But if you find yourself adding lots on -non-Exported methods to your Maypole model classes, -and these methods are not there to support Exported methods, consider whether -you could separate out the domain model into a separate hierarchy of classes -that you import into the Maypole model. +To a certain extent, this is fine. But if you find yourself adding lots on +non-Exported methods to your Maypole model classes, and these methods are not +there to support Exported methods, consider whether you could separate out the +domain model into a separate hierarchy of classes that you import into the +Maypole model. See L. The distinction between the Maypole model, the domain model, and the model in the MVC pattern, is fuzzy and variable. In straightforward Maypole applications, they're all pretty much the same thing. In more advanced applications, they -begin to diverge. Take care out there. +begin to diverge. See C. =item view This is represented in Maypole by the view class (L, L, or L), and by the templates. +=head3 Presentation Model + +This pattern seems to more accurately describe the role of the Maypole model. +Martin Fowler describes I in L +and L. + +The View sends events (e.g. an HTTP request that triggers an Exported method) to +the Presentation Model. This layer responds by interacting with the underlying +domain model, and stores the results in a bunch of variables, which represent +the new state of the View. The View then queries the Presentation Model to +retrieve these new values. In Maypole, this is the role of the C method +on L, which transmits the new values to the templates. =back -- 2.39.5