
A simple diagram depicting the relationship between the Model, View, and Controller. Note: the solid lines indicate a direct association, and the dashed lines indicate an indirect association (e. g. ,
observer pattern).
The observer pattern (sometimes known as Publish/subscribe) is a design pattern used in computer programming to observe the state of an object in a Model-view-controller (MVC) is an architectural pattern used in software engineering. Architectural patterns are software patterns that offer well-established solutions to architectural problems in Software engineering. Software engineering is the application of a systematic disciplined quantifiable approach to the development operation and maintenance of Software. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. Business logic is a non-technical term generally used to describe the functional Algorithms which handle Information exchange between a Database and a The user interface (or Human Computer Interface) is the aggregate of means by which people&mdash the users '&mdash interact with the System Business rules or business rulesets describe the operations definitions and constraints that apply to an organization in achieving its goals In MVC, the Model represents the information (the data) of the application and the business rules used to manipulate the data, the View corresponds to elements of the user interface such as text, checkbox items, and so forth, and the Controller manages details involving the communication to the model of user actions such as keystrokes and mouse movements. In Computing, a mouse (plural mice, mouse devices, or mouses)
History
The pattern was first described in 1979[1] by Trygve Reenskaug, then working on Smalltalk at Xerox PARC. Trygve Mikkjel Heyerdahl Reenskaug (born 1930) is a Norwegian computer scientist Smalltalk is an object-oriented, dynamically typed, reflective programming language. PARC (Palo Alto Research Center Inc formerly Xerox PARC, is a Research and development company in Palo Alto California that began as a division of The original implementation is described in depth in the influential paper Applications Programming in Smalltalk-80: How to use Model-View-Controller. [2]
After that numerous derivatives of the MVC pattern appeared. Probably one of the most known of them is the Model View Presenter pattern, which appeared in the early 90s and was designed to be an evolution of mvc(model view controller) However Model-View-Controller still remains very popular and widely used. Model View Presenter is a software pattern considered as a derivative of the Model-view-controller.
Pattern description
It is common to split an application into separate layers: presentation (UI), domain logic, and data access. In MVC the presentation layer is further separated into view and controller. MVC encompasses more of the architecture of an application than is typical for a design pattern. In Software engineering, a design pattern is a general reusable solution to a commonly occurring problem in Software design.
- Model
- The domain-specific representation of the information on which the application operates. Domain logic adds meaning to raw data (e. g. , calculating if today is the user's birthday, or the totals, taxes, and shipping charges for shopping cart items).
- Many applications use a persistent storage mechanism (such as a database) to store data. A Computer Database is a structured collection of records or data that is stored in a computer system MVC does not specifically mention the data access layer because it is understood to be underneath or encapsulated by the Model.
- View
- Renders the model into a form suitable for interaction, typically a user interface element. The user interface (or Human Computer Interface) is the aggregate of means by which people&mdash the users '&mdash interact with the System Multiple views can exist for a single model for different purposes.
- Controller
- Processes and responds to events, typically user actions, and may invoke changes on the model.
MVC is often seen in web applications, where the view is the actual HTML page, and the controller is the code that gathers dynamic data and generates the content within the HTML. In Software engineering, a web application or webapp is an application that is accessed via Web browser over a network such as the Internet HTML, an initialism of HyperText Markup Language, is the predominant Markup language for Web pages It provides a means to describe the structure Finally, the model is represented by the actual content, usually stored in a database or in XML nodes, and the business rules that transform that content based on user actions. A Computer Database is a structured collection of records or data that is stored in a computer system Don't change "Extensible"
Though MVC comes in different flavors, control flow generally works as follows:
- The user interacts with the user interface in some way (e. g. presses a button).
- A controller handles the input event from the user interface, often via a registered handler or callback. The user interface (or Human Computer Interface) is the aggregate of means by which people&mdash the users '&mdash interact with the System In computer programming an event handler is an asynchronous callback subroutine that handles inputs received in a program In Computer programming, a callback is Executable code that is passed as an argument to other code
- The controller notifies the model of the user action, possibly resulting in a change in the model's state. (e. g. controller updates user's Shopping cart). Shopping cart software is software used in e-commerce to assist people making purchases online analogous to the American English term ' Shopping cart ' [3]
- A view uses the model (indirectly) to generate an appropriate user interface (e. g. the view produces a screen listing the shopping cart contents). The view gets its own data from the model. The model has no direct knowledge of the view.
- The user interface waits for further user interactions, which begins the cycle anew.
By decoupling models and views, MVC helps to reduce the complexity in architectural design, and to increase flexibility and reuse.
Selected frameworks
GUI frameworks
Java: Java Swing
Java Swing is different from the other frameworks, in that it supports two MVC patterns:
Model
- Frame level model-- Like other frameworks, the design of the real model is usually left to the developer. Swing is a Widget toolkit for Java. It is part of Sun Microsystems ' Java Foundation Classes (JFC &mdash an API for providing
- Control level model-- Swing also supports models on the level of controls (elements of the graphical user interface). In computer programming a widget (or control) is an element of a Graphical user interface (GUI that displays an information arrangement changeable by the user Unlike other frameworks, Swing exposes the internal storage of each control as a model.
- View
- The view is represented by a class that inherits from Component.
- Controller
- Java Swing doesn't necessarily use a single controller. Because its event model is based on interfaces, it is common to create an anonymous action class for each event. In fact, the real controller is in a separate thread (the Event dispatching thread). A thread in Computer science is short for a thread of execution. The event dispatching thread (EDT is a background thread used in Java to process events from the Abstract Windowing Toolkit (AWT Graphical user interface It catches and propagates the events to the view and model.
Combined frameworks
Java: Java Enterprise Edition (Java EE)
Unlike the other frameworks, Java EE defines a pattern for model objects. Java Platform Enterprise Edition or Java EE is a widely used platform for server programming in the Java programming language
- Model
- The model is commonly represented by entity beans, although the model can be created by a servlet using a business object framework such as Spring. An Entity Bean is a type of Enterprise JavaBean, a server-side J2EE component that represents persistent data maintained in a Database. The Java Servlet API allows a Software developer to add dynamic content to a Web server using the Java platform. The Spring Framework (or Spring for short is an Open source Application framework for the Java platform.
- View
- The view in a Java EE application may be represented by a Java Server Page, which may be currently implemented using JavaServer Faces Technology (JSF). JavaServer Pages ( JSP) is a Java technology that allows Software developers to dynamically generate HTML, XML or other types of documents JavaServer Faces ( JSF) is a Java -based Web application framework intended to simplify development of User interfaces for Java Alternatively, the code to generate the view may be part of a servlet.
- Controller
- The controller in a Java EE application may be represented by a servlet, which may be currently implemented using JavaServer Faces (JSF). JavaServer Faces ( JSF) is a Java -based Web application framework intended to simplify development of User interfaces for Java
Implementations of MVC as GUI frameworks
Smalltalk's MVC implementation inspired many other GUI frameworks, such as the following:
- Core Data framework in Mac OS X, a modern addition to Cocoa. Core Data is part of the Cocoa API in Mac OS X, first introduced in Mac OS X 10 Mac OS X (mæk oʊ ɛs tɛn is a line of computer Operating systems developed marketed and sold by Apple Inc, the latest of which is pre-loaded on all currently Cocoa is Apple Inc 's native Object-oriented application program environment for the Mac OS X Operating system
- GNUstep, based on these technologies, also use MVC. GNUstep is a Free software implementation of NeXT 's OpenStep Objective-C libraries (called frameworks) Widget toolkit
- GTK+
- JFace
- Microsoft Foundation Classes (MFC) (called Document/View architecture here)
- NeXTSTEP development environments encourage the use of MVC. GTK+, or The GIMP Toolkit, is a Cross-platform Widget toolkit for creating Graphical user interfaces It is one of the most popular toolkits JFace is defined by the Eclipse project as "a UI toolkit that provides helper classes for developing UI features that can be tedious to The Microsoft Foundation Class Library (also Microsoft Foundation Classes or MFC) is a library that wraps portions of the Windows API Nextstep was the original object-oriented, multitasking Operating system that NeXT Computer developed to run on its range of proprietary computers Cocoa
- OPENSTEP development environments encourage the use of MVC. Cocoa is Apple Inc 's native Object-oriented application program environment for the Mac OS X Operating system OpenStep is an Object-oriented Application programming interface (API specification for an Object-oriented operating system that uses any modern Operating Cocoa
- Qt Toolkit since Qt4 Release. Cocoa is Apple Inc 's native Object-oriented application program environment for the Mac OS X Operating system Qt (pronounced "cute" by its creators is a Cross-platform application development framework widely used for the development of GUI programs (in which
- Java Swing
- Windows Presentation Foundation (WPF) uses a similar Model-view-viewmodel pattern. Swing is a Widget toolkit for Java. It is part of Sun Microsystems ' Java Foundation Classes (JFC &mdash an API for providing The Windows Presentation Foundation (or WPF) formerly code-named Avalon, is a graphical subsystem in.
Visual FoxExpress is a Visual FoxPro MVC framework.
Implementations of MVC as web-based frameworks
In the design of web applications, MVC is implemented by web template systems as "View for web" component. A Web template system describes the software and methodologies used to produce Web pages and for deployment on Websites and delivery over the Internet.
MVC is typically implemented as a "Model 2" architecture in Sun parlance. In the design of Java Web applications there are two commonly-used design models referred to as Model 1 and Model 2. Sun Microsystems Inc ( is a multinational vendor of Computers computer components Computer software, and Information technology services Model2 focuses on efficiently handling and dispatching full page form posts and reconstructing the full page via a front controller. Complex web applications continue to be more difficult to design than traditional applications because of this "full page" effect. More recently AJAX driven frameworks that focus on firing focused UI events at specific UI Components on the page are emerging. This is causing MVC to be revisited for web application development using traditional desktop programming techniques.
. NET
- ASP.NET MVC Framework ( MVC home on the ASP.NET web site )
- Igloo software (Experimental) MVC Framework for . The ASPNET MVC Framework is a Model-view-controller framework which Microsoft is adding to ASP NET 2. 0
- Maverick.NET
- Microsoft UIP
- Monorail An ActionPack inspired MVC framework from the Castle Project
- PureMVC Framework for C# Supports . MaverickNET is a Maverick port from Java to C# for its integration in the. MonoRail, a component of the Castle Project, is an Open source Web application framework built on top of the ASP NET, Windows Mobile, Pocket PC, and Silverlight development platforms
- Web Client Software Factory
- MVC# Framework Actually is a Model View Presenter framework. Model View Presenter is a software pattern considered as a derivative of the Model-view-controller. But as such has much in common with MVC.
- NMVP
ActionScript
ASP
Erlang
Java
MVC web application frameworks:
JavaScript
- CJAX Rajesh ascript development tool for AJAX
- Archetype Javascript Framework for structuring and ease development of RIA. Cairngorm is one of the primary Open source frameworks for application architecture in Adobe Flex. This article is about the computer programming language For the nuclear reactions see Cold fusion. Mach-II is an open-source object-oriented Web application framework based on the Model-view-controller design pattern Aranea framework is an Open Source ( APL 20 Java Hierarchical Model-View-Controller web framework that provides a common simple approach to building the Grails is an Open source Web application framework which leverages the Groovy programming language (which is in turn based on the Java platform Oracle Application Framework (OA Framework is a proprietary framework developed by Oracle Corporation for application development within the Oracle E-Business Suite The Spring Framework (or Spring for short is an Open source Application framework for the Java platform. Tapestry is an Object-oriented Java Web application framework to implement applications in accordance with the Model-view-controller design WebObjects is a Java web Application server from Apple Inc, and a Web application framework that runs on this server WebWork was a Java-based Web application framework developed by OpenSymphony that merged into the current Struts2 framework JavaServer Faces ( JSF) is a Java -based Web application framework intended to simplify development of User interfaces for Java Rich Internet applications (RIAs are Web applications that have the features and functionality of traditional desktop applications.
- JavaScript MVC An open-source JavaScript framework for developing web applications.
- Junction A Ruby on Rails port to Javascript.
- JamalA Javascript framework built on top of jQuery.
- DojoMVCA Dojo based MVC framework that integrates Dojo and jQuery.
Informix 4GL
Object-Pascal
- Powtils Ongoing development on a new MVC library for web programming with Object-Pascal (FreePascal, Delphi etc).
Perl
- Catalyst An MVC-based avant-garde web framework. Catalyst is an Open source Web application framework written in Perl, that closely follows the Model-view-controller (MVC architecture
- CGI::Application A mature, lightweight, flexible MVC framework for web application development.
- Gantry Framework A web application framework for Apache/mod_perl, CGI and Fast-CGI.
- Jifty A full-stack application framework.
- Maypole A Perl framework for MVC-oriented web applications, similar to Jakarta's Struts
- OpenInteract2 is a web application server written in Perl. It features integrated data persistence, security, user and group management, plus an easy way to create and distribute fully database-independent applications.
- PageKit A mod_perl based web application framework that uses a template system and XML.
PHP
- Agavi an open-source, LGPL licensed MVC framework for creating applications written using PHP5.
- AGLite Framework Simple, easy and flexible framework for PHP.
- Akelos PHP Framework a Ruby on Rails port to PHP4/5. The Akelos PHP Framework is a PHP port of the Web application framework Ruby on Rails. Ruby on Rails is an Open source Web application framework for the Ruby programming language. PHP is a computer Scripting language. Originally designed for producing Dynamic web pages it has evolved to include a Command line interface capability
- BareBonesMVC A one-file, no-configuration, MVC framework for PHP5.
- CakePHP webapplication framework modeled after the concepts of Ruby on Rails. CakePHP is an Open source Web application framework written in PHP, modeled after the concepts of Ruby on Rails, and distributed under the Ruby on Rails is an Open source Web application framework for the Ruby programming language.
- CodeIgniter A PHP MVC framework. CodeIgniter is an Open source Web application framework for use in building dynamic web sites with PHP.
- DragonPHP MVC2 Framework for PHP 5.
- Drupal Community plumbing: open source modular framework and content management system. Drupal (ˈdɹuːpʰəl is a free and Open source modular framework and Content management system (CMS written in the programming language
- FLOW3 A PHP5 / PHP6 based enterprise application framework, with MVC, Dependency Injection, Aspect-Oriented Programming and more.
- FUSE A powerful but easy-to-use PHP 5 Framework for MVC development
- Fusebox Framework for building ColdFusion and PHP web applications. FUSE is a PHP framework created by Jim Keller that uses Model-view-controller architecture along with Object-relational mapping Data Modeling
- Jelix Framework an open source PHP 5 MVC framework designed for highly performance.
- KohanaPHP A powerful, lightweight, easily extendable PHP 5 MVC Framework. Kohana is an Open source, PHP5 Web application framework that uses the Model View Controller architectural pattern
- Kumbia Framework Simple, easy and flexible framework for PHP.
- LightVC Lightweight PHP 5 Strict MVC Framework with decoupling of Model and other non-View-Controller essentials to promote code reuse.
- Lion Framework An open-source PHP 5 framework with a push & pull MVC implementation
- MicMVC A simple framework for creating standalone MVC websites in PHP5 with RoR style models.
- Odin Assemble Small footprint PHP based MVC Framework. Odin Assemble is a free Closed source PHP Web application framework. PHP is a computer Scripting language. Originally designed for producing Dynamic web pages it has evolved to include a Command line interface capability
- OnPHP onPHP is the mature GPL'ed multi-purpose object-oriented PHP framework (plus c-module)
- PHP on Trax Strictly follows Ruby on Rails syntax and functionality but written in php5. Ruby on Rails is an Open source Web application framework for the Ruby programming language. Originally called PHP on Rails.
- phpHtmlLib MVC based OO framework compatible with PHP4 and PHP5 licensed under GNU LGPL.
- phpXCore A MVC design pattern based PHP content management framework compatible with PHP4 and PHP5. phpXCore is a free Open source Content management framework for creating customized Content management systems written in PHP.
- PRADO A PHP 5 MVC framework. PRADO is a component-based and event-driven Web application framework for PHP 5
- PureMVC Framework for PHP
- Qcodo is an open-source PHP 5 web application framework
- SilverStripe contains a fully fledged PHP 5. The QCodo Development Framework is an open-source PHP 5 Web application framework which builds an Object Relational Model ( ORM) CRUD (Create Retrieve Update Delete SilverStripe is a free and open source programming framework and Content management system (CMS for creating and maintaining websites 2 ORM/MVC Framework focused on building websites.
- Solar PHP 5 framework Solar is a PHP 5 framework for rapid application development. It is fully name-spaced and uses enterprise application design patterns, with built-in support for localization and configuration at all levels.
- Switch board with Routing PHP 5 MVC Framework with Routing.
- Symfony Framework PHP 5 MVC Framework. Symfony is a Web application framework written in PHP which follows the Model-view-controller (MVC paradigm
- TinyMVC Framework Simple and lightweight PHP5 MVC (Model-View-Controller) framework.
- TYPO3 extension library lib/div PHP 4/5 MVC framework for TYPO3 extension development
- XPT Framework A PHP 5 MVC framework.
- Zend Framework A PHP 5-based MVC framework. Zend Framework is an Open source, Object-oriented Web application framework implemented in PHP 5 and licensed under the New BSD License
- ZNF PHP5 MVC framework for enterprise web applications
- Zoop Framework A Mature PHP 4/5 MVC framework. ZNF is a Framework for developing PHP5 Web applications It was originally based on the Apache Struts project of the Apache Software Foundation Zoop Framework stands for Zoop Object Oriented PHP Framework Zoop is a Free software, object oriented Web application framework for PHP based
- Zym Framework A Zend Framework extension
Python
- Django A complete Python web application framework. Zend Framework is an Open source, Object-oriented Web application framework implemented in PHP 5 and licensed under the New BSD License Django (pronunciation /ˈdʒæŋgoː/ is an Open source Web application framework, written in Python, which loosely follows the Model-view-controller Django prefers to call its MVC implementation MTV, for Model-Template-View [1].
- PureMVC Framework for Python
- Pylons - Python Web Framework
- Spring Python
- TurboGears for Python
- web2py A full-stack python web application framework
- Zope Content Management Framework
Ruby
See also
References
- ^ http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html
- ^ How to use Model-View-Controller (MVC)
- ^ Complex controllers are often structured using the command pattern to encapsulate actions and simplify extension. TurboGears is a Python Web application framework consisting of several underlying components such as MochiKit, SQLObject, CherryPy Zope is a free and open-source, Object-oriented web Application server written in the Python Programming language. Camping is a Web application framework which consistently stays at less than 4 Merb is a Model View Controller Web framework written in Ruby. Nitro is a Ruby -based Web application framework created by George Moschovitis. Ruby on Rails is an Open source Web application framework for the Ruby programming language. Trygve Mikkjel Heyerdahl Reenskaug (born 1930) is a Norwegian computer scientist Architectural patterns are software patterns that offer well-established solutions to architectural problems in Software engineering. Model View Presenter is a software pattern considered as a derivative of the Model-view-controller. In the design of Java Web applications there are two commonly-used design models referred to as Model 1 and Model 2. In Software engineering, multi-tier architecture (often referred to as n-tier architecture) is a Client-server architecture in which an application The observer pattern (sometimes known as Publish/subscribe) is a design pattern used in computer programming to observe the state of an object in a In Software engineering, the template method pattern is a design pattern. Presentation-abstraction-control (PAC is a software architectural pattern, somewhat similar to Model-view-controller (MVC Naked objects is an architectural pattern used in Software engineering. Model-view-adapter ( MVA) is an architectural pattern, which at the same time is also a Multitier architecture, used in Software engineering. In Object-oriented programming, the Command pattern is a design pattern in which objects are used to represent actions
External links
General information regarding MVC
© 2009 citizendia.org; parts available under the terms of GNU Free Documentation License, from http://en.wikipedia.org
network: | |