views:

217

answers:

5

I'm familiar with the Front Controller pattern, in which all events/requests are processed through a single centralized controller.

But what would you call it when you wish to keep the various parts of an application separate at the presentation layer as well? My first thought was "Facade" but it turns out that's something entirely different.

In my particular case, I'm converting an application from a sprawling procedural mess to a clean MVC architecture, but it's a long-term process -- we need to keep things separated as much as possible to facilitate a slow integration with the rest of the system. Our application is web-based, built in PHP, so for instance, we have an "index.php" and an IndexController, a "account.php" and an AccountController, a "dashboard.php" and DashboardController, and so on.

+2  A: 

I'm confused exactly what you're asking here, because the presentation layer is already separate -- views provide that function. If you have common portions of a page that should exist in all views, perhaps you're looking for something like the View Helper pattern? Using existing PHP development frameworks like Zend_Framework or CakePHP or CodeIgniter have ways to do this built-in.

Billy ONeal
+2  A: 

Adapter, Factory, and Strategy would all seem to be applicable ways of hiding an underlying code but like BillyONeal, I'm not sure what you are asking as it would appear that simply modularizing the code would work but I'm not aware of a modular pattern.

JB King
+1 for mentioning explicit patterns instead of my attempt. :P
Billy ONeal
+2  A: 

PoEAA calls something like this a "Page Controller", one module on each web server acting as the controller for each page on the site.

JasonTrue
Here's another link to Page Controller: http://msdn.microsoft.com/en-us/library/ms978764.aspxIt appears to be what I'm looking for. Thanks Jason!
Brian Lacy
+1  A: 

Have a look at the Web Presentation Patterns of PoEAA:

  • Model View Controller - Splits user interface interaction into three distinct roles.
  • Page Controller - An object that handles a request for a specific page or action on a Web site.
  • Front Controller - A controller that handles all requests for a Web site.
  • Template View - Renders information into HTML by embedding markers in an HTML page.
  • Transform View - A view that processes domain data element by element and transforms it into HTML.
  • Two-Step View -Turns domain data into HTML in two steps: first by forming some kind of logical page, then rendering the logical page into HTML.
  • Application Controller - A centralized point for handling screen navigation and the flow of an application.
Gordon
A: 

I would even go so far as to call it a Composition of Controllers. So you could call it Modular Composition Controller.

mugafuga