CSC/ECE 517 Fall 2013/ch1 1w27 ma: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 8: Line 8:


=== Model ===
=== Model ===
The Model generally contains the data for the application and is usually linked to a database back-end.
: The Model generally contains the data for the application and is usually linked to a database back-end.
It contains the application state and also most of the business logic. The model has no knowledge of the user interfaces.
:It contains the application state and also most of the business logic. The model has no knowledge of the user interfaces.


=== View ===
=== View ===
The view refers to the interface that is presented to the end-user. The view does not do any processing, but simply acts as the presentation layer, displaying the application data.
:The view refers to the interface that is presented to the end-user. The view does not do any processing, but simply acts as the presentation layer, displaying the application data.


=== Controller ===
=== Controller ===
The controller receives events from the outside world [ or through some view] and performs some processing
:The controller receives events from the outside world [ or through some view] and performs some processing
It interacts with the model and redirects to the appropriate view.
It interacts with the model and redirects to the appropriate view.


== MVC Rails ==
== MVC Rails ==
=== Directory Structure ===
=== Directory Structure ===

Revision as of 01:41, 16 September 2013

MVC architecture structure in Ruby on Rails

What is MVC

MVC is a design pattern and was developed in 1979 by Trygve Reenskaug (Smalltalk).

MVC dictates that the system be split into three distinct parts, a Model, View and Controller

Model

The Model generally contains the data for the application and is usually linked to a database back-end.
It contains the application state and also most of the business logic. The model has no knowledge of the user interfaces.

View

The view refers to the interface that is presented to the end-user. The view does not do any processing, but simply acts as the presentation layer, displaying the application data.

Controller

The controller receives events from the outside world [ or through some view] and performs some processing

It interacts with the model and redirects to the appropriate view.

MVC Rails

Directory Structure