architect-handbook

Software Architect Handbook

View on GitHub

Front Controller

A controller that handles all requests for a Web site.

Overview

In a complex Web site there are many similar things you need to do when handling a request (e.g., security, internationalization, providing particular views for certain users). If the controller behavior is scattered across multiple objects, much of this behavior can end up being duplicated and it’s difficult to change at runtime.

The Front Controller consolidates all request handling by channeling requests through a single handler object. This object can carry out common behavior, which can be modified at run time with decorators. The handler then dispatches to command objects for behavior particular to a request.

How It Works

When to Use It