Front Controller pattern
Encyclopedia
The Front Controller Pattern is a software design pattern
Design pattern
A design pattern in architecture and computer science is a formal way of documenting a solution to a design problem in a particular field of expertise. The idea was introduced by the architect Christopher Alexander in the field of architecture and has been adapted for various other disciplines,...

 listed in several pattern catalogs. The pattern relates to the design of web applications. It "provides a centralized entry point for handling requests."

The front controller may be implemented as a Java object, or as a script in a script language like PHP, ASP, CFML or JSP that is called on every request of a web session. This script, for example an index.php, would handle all tasks that are common to the application or the framework, such as session handling, caching, and input filtering. Based on the specific request it would then instantiate further objects and call methods to handle the particular task(s) required.

The alternative to a front controller would be individual scripts like login.php and order.php that would each then satisfy the type of request. Each script would have to duplicate code or objects that are common to all tasks. But each script might also have more flexibility to implement the particular task required.

Examples

Several web-tier application frameworks implement the Front Controller pattern, among them:
  • Ruby on Rails
    Ruby on Rails
    Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...

  • ColdBox, a ColdFusion
    ColdFusion
    In computing, ColdFusion is the name of a commercial rapid application development platform invented by Jeremy and JJ Allaire in 1995. ColdFusion was originally designed to make it easier to connect simple HTML pages to a database, by version 2 it had...

     MVC framework.
  • Spring MVC, a Java
    Java (programming language)
    Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

     MVC framework
  • Yii
    Yii
    Yii is an open source, object-oriented, high-performance component-based PHP web application framework. Yii is pronounced as "Yee" or [ji:] and it's an acronym for "Yes It Is!".- History :...

    , Cake, Drupal
    Drupal
    Drupal is a free and open-source content management system and content management framework written in PHP and distributed under the GNU General Public License. It is used as a back-end system for at least 1.5% of all websites worldwide ranging from personal blogs to corporate, political, and...

    , Symfony
    Symfony
    Symfony is a web application framework written in PHP which follows the model-view-controller paradigm. Released under the MIT license, Symfony is free software...

    , Kohana
    Kohana
    Kohana may refer to:*Kohana , a captive orca*Kohana, a Kamen Rider Den-O character*Kohana cat, a minor cat breed*Kohana Framework, a PHP 5 framework*Kohana , a local holiday in the Netherlands...

     and Zend Framework
    Zend Framework
    Zend Framework is an open source, object-oriented web application framework implemented in PHP 5 and licensed under the New BSD License.-Licensing:...

    , frameworks written with PHP
    PHP
    PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

  • Cairngorm
    Cairngorm (Flex framework)
    Cairngorm was one of the primary open source frameworks for application architecture in Adobe Flex. It was developed by iteration::two, who was acquired by Macromedia in 2005. It is part of the Adobe Engagement Platform....

     framework in Adobe Flex
    Adobe Flex
    Adobe Flex is a software development kit released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on the Adobe Flash platform...

    .
  • Microsoft's ASP.NET MVC Framework
    ASP.NET MVC Framework
    The ASP.NET MVC Framework is a web application framework that implements the model-view-controller pattern. Based on ASP.NET, it allows software developers to build a Web application as a composition of three roles: Model, View and Controller. A model represents the state of a particular aspect of...

    .
  • Yesod web application framework written in Haskell
    Haskell
    Haskell may refer to:*Haskell , a standardized pure functional programming language with non-strict semantics* Haskell Indian Nations University, a four year degree granting university in Lawrence, Kansas which offers free tuition to members of registered Native American tribes in the United...

    .

See Also

  • Design pattern (computer science)
    Design pattern (computer science)
    In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that...

  • Mediator pattern
    Mediator pattern
    The mediator pattern, one of the 23 design patterns described in Design Patterns: Elements of Reusable Object-Oriented Software, provides a unified interface to a set of interfaces in a subsystem. This pattern is considered to be a behavioral pattern due to the way it can alter the program's...

    *Note: the Front Controller pattern is a specialized kind of Mediator pattern.

External Links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK