CSC/ECE 517 Fall 2009/wiki1b 13 za: Difference between revisions

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


== How it came into prominence ==
== How it came into prominence ==
MVC offers a clear separation of the presentation logic from the business logic. With an MVC framework, it becomes easy to accommodate future changes and implementations in design or code. MVC pattern gained prominence because of its clean modular approach that allow programmers to follow a formal approach for implementing business or enterprise level applications. Though, it is worth mentioning that using the MVC methodology for designing applications requires a lot of planning in terms of working out the separations in design and how the modules would interact. What is achieved by keeping these functionalities separate is ''reusability'' which is one of the major advantages of MVC.
MVC offers a clear separation of the presentation logic from the business logic. This is the main reason why it is widely used architecture for web-based application. With an MVC framework, it becomes easy to accommodate future changes and implementations in design or code. MVC pattern gained prominence because of its clean modular approach that allow programmers to follow a formal approach for implementing business or enterprise level applications. Though, it is worth mentioning that using the MVC methodology for designing applications requires a lot of planning in terms of working out the separations in design and how the modules would interact. What is achieved by keeping these functionalities separate is ''reusability'' which is one of the major advantages of MVC.
 


== Comparison of the MVC implementations in various web-based frameworks ==
== Comparison of the MVC implementations in various web-based frameworks ==

Revision as of 02:18, 20 September 2009

History and Applications of the MVC Pattern

Image taken from www.symfony-project.org

Trygve Reenskaug

Trygve Reenskaug has published historical documents on MVC that date back to 1973. His first note on the MVC pattern consisted of : Model, View, Controller and Editor. The 'Editor' is a short-lived component that the 'View' creates when necessary. This component is created as an interface between the 'View' and the input devices. After Reenskaug left Xerox PARC, Jim Althoff with a group of other people implemented a version of MVC specific to the Smalltalk-80 class library [Ref [1]]. MVC pattern served as a means to simplify the implementation of complex systems.

The MVC design pattern is different from the MVC architectural pattern. In fact there are many other design patterns - Analysis, Creational, Structural, Behavioral [Ref [2]]. Ward Cunningham and Ken Beck who were working with Smalltalk were the first to start the MVC design pattern in 1987.

More information on the use of MVC as an architectural pattern or a design pattern can be found at [3]


MVC - the buzz term!

MVC (Model-View-Controller) offers a framework consisting of a Model that represents the logical form of data. For example, in an e-commerce business setting, a shopping cart is a model that would represent the underlying data for the business. A View is pertaining to the user-interface. It helps the user to interact with the Model. Finally the Controller acts as the point of communication between the Model and the View, taking inputs or requests from the user and manipulating or processing the underlying data accordingly to provide the user with the desired outputs.

MVC (Model-View-Controller) offers a framework consisting of a Model that enforces the logical rules that should be applied to the data. A View is pertaining to the user-interface. It helps the user to interact with the Model. Finally the Controller acts as the point of communication between the Model and the View, taking inputs or requests from the user and manipulating or processing the underlying data accordingly to provide the user with the desired outputs.

For example, in an e-commerce business setting, a model will make sure that the shipping charges are correctly applied, a view will generate pages displaying the items available and a controller will make sure to add selected products to the cart of the customer.

How it came into prominence

MVC offers a clear separation of the presentation logic from the business logic. This is the main reason why it is widely used architecture for web-based application. With an MVC framework, it becomes easy to accommodate future changes and implementations in design or code. MVC pattern gained prominence because of its clean modular approach that allow programmers to follow a formal approach for implementing business or enterprise level applications. Though, it is worth mentioning that using the MVC methodology for designing applications requires a lot of planning in terms of working out the separations in design and how the modules would interact. What is achieved by keeping these functionalities separate is reusability which is one of the major advantages of MVC.

Comparison of the MVC implementations in various web-based frameworks

MVC being a framework can be exploited to work with various languages. A list of such languages would include C++, JAVA, Ruby, Flex, DOT NET and many more [Ref [4]]. We make an attempt here to compare the different implementations of MVC, with respect to the different programming and markup languages.

Ruby

Ruby on Rails is the most widely know MVC framework pattern [5]

  • Model (ActiveRecord ) :Maintains the relationship between Object and Database and handles validation, association, transactions, and more.
  • View ( ActionView ) :A presentation of data in a particular format, triggered by a controller's decision to present the data. They are script based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.
  • Controller ( ActionController ): The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organizing that data (searching, sorting, massaging it) into a form that fits the needs of a given view. ActionController is thus a data broker sitting between ActiveRecord (the database interface) and ActionView (the presentation engine).

Flex

Cairngnorm is considered to be the best practice methodology for Flex software design [6]

JAVA

There are many frameworks like Struts, Spring which adopt the MVC methodology and are pertaining to JAVA.


PHP

It has a plethora of MVC implementations. The top 10 MVC-based PHP frameworks are

  1. Symfony: Based on Mojavi and inspired by Rails
  2. Mojavi
  3. CakePHP: Inspired by Rails PHP4/5
  4. PHPOnTrax: a Rails port - PHP5 Only
  5. Prado: The winner of Zend coding contest
  6. Studs: A Java-Struts port to PHP
  7. Phrame: A Java-Struts port
  8. Achievo: A good RAD framework
  9. WACT: Web Application Component Toolkit
  10. Ambivalence: A Java-Maverick Port

References