Citizendia

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).
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)

Contents

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:

  1. The user interacts with the user interface in some way (e. g. presses a button).
  2. 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
  3. 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]
  4. 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.
  5. 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:

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

ActionScript

ASP

ColdFusion

Erlang

Java

MVC web application frameworks:

JavaScript

Informix 4GL

Object-Pascal

Perl

PHP

Python

Ruby

See also

References

  1. ^ http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html
  2. ^ How to use Model-View-Controller (MVC)
  3. ^ 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
Dapyx Software network: MP3 Explorer | Ebook Manager | Zenithic