Active record pattern An approach to accessing data in a database. Each table or view is wrapped into a class. The class provides functions for creating new rows, retrieving data, updating existing data and deleting data (CRUD)

Facts, Thoughts and Opinions

Design Patterns: Facade, Proxy, Adapter

Facade, Proxy, and Adapter are the same approach (putting a mediation between two objects) to three different problems.

MVC Pattern Overview

The MVC pattern separates the modeling of the application domain, the presentation, and the actions based on user input into three separate classes:

  • The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).
  • The view manages the presentation of data to the user and transmits user input to the controller.
  • The controller interprets the user input transmitted to it, informing the model and/or the view to change as appropriate.

In a traditional client-side application, the pattern is quite straightforward. The user interacts directly with the view, and the view communicates with the controller. The controller processes requests from the view, makes requests of the model, and returns data from the model to the view. On the Web, however, the pattern is not quite as straightforward. The view outputs HTML, CSS and JavaScript to provide the interface that the user actually utilizes.

In recent years, web developers have learned that there are really two entirely separate MVC "stacks" in play: one on the server, one on the client. Modern JavaScript frameworks such as AngularJS and Backbone have emerged to support this paradigm to varying degrees.

The server-side stack uses an application framework such as Zend.

Server Client
Controller Model View Controller Model View
Zend controller Doctrine model Zend .phtml Backbone view controller Backbone collection HTML, CSS, JavaScript