Http:/pg.ece.ncsu.edu/mediawiki/index.php/CSC/ECE 517 Fall 2007/wiki2 3 77: Difference between revisions
No edit summary |
No edit summary |
||
Line 35: | Line 35: | ||
Any concept explained through an example is better understood than just theoretical description.Thus, while categorizing websites higher priority is given to those which explain MVC with an example. | Any concept explained through an example is better understood than just theoretical description.Thus, while categorizing websites higher priority is given to those which explain MVC with an example. | ||
;* | ;*http://cristobal.baray.com/indiana/projects/mvc.html | ||
:This site provides the perfect place for a novice of MVC to start. This was written in a conversational style and easy to understand. As we proceed with the blue arrows provided on the right bottom corner or the right-top corner, the author slowly develops MVC concept and explains it through a very simple instructive example of "Heart-Beat". | :This site provides the perfect place for a novice of MVC to start. This was written in a conversational style and easy to understand. As we proceed with the blue arrows provided on the right bottom corner or the right-top corner, the author slowly develops MVC concept and explains it through a very simple instructive example of "Heart-Beat". | ||
:Example: The heart-beat example consists of the interface as shown below . | :Example: The heart-beat example consists of the interface as shown below . | ||
[[Image:Heartbeat.JPG]] | [[Image:Heartbeat.JPG]] | ||
This particular example creates 2 separate Java windows for view and controller.After the details how this example is implemented, the author again explains the concept of MVC with respect to the example. | This particular example creates 2 separate Java windows for view and controller.After the details how this example is implemented, the author again explains the concept of MVC with respect to the example. | ||
[[Image: | [[Image:NOW.JPG]] | ||
;*[http://www.adobe.com/devnet/flash/articles/mv_controller.html MVC throughly dealt] | |||
:Starting off with a one line description of MVC and with a "Toggle button" example, this chapter "The Model-View-Controller Design Pattern" from the book "Essential ActionScript 2.0" provides a very instructive explaination of MVC design pattern.The responsibilities of the MVC are elaborated with a running example of a Clock. | |||
[[Image:Adobe_MVC.gif]] | |||
This site gives 2 examples, "Toggle" and "Clock", second one being the running example across the excerpt.This example explains the responsibilities of each model,view. It also justifies the usage of MVC with the example which gives us a better insight into the MVC architecture as a whole. | |||
;*http://ist.berkeley.edu/as/ag/pub/pdf/mvc-seminar.pdf Seminar pdf on MVC | |||
:This provides a brief info on the history of design patterns and in particular MVC. The seminar proceeds to provide a brief introduction to MVC and then proceeds to its example of "Student_Information".It then uses this example to explain in detail the concept of each of the Model, View and Controller. It also provides information about various technologies available for implementing MVC. | |||
:This pdf provides a application Student_Information as an example of MVC. In this application, the view displays the info, the model stores the relevant information and the controller provides the relevant API's needed for receiving user_input and updating the model appropriately. | |||
[[Image:Mvc_2.JPG|thumb|150px]] | |||
;*http://www.enode.com/x/markup/tutorial/mvc.html | |||
:This page, which is part of a tutorial, provides very basic definition of MVC and is accompanied by an instructive example of a "Spinner". | |||
:This example explains how the data in the model is displayed by the view and how an "event action" is recognized by the controller which modifies model as required. It also briefly introduces the concept of multiple controllers modifying the same model. | |||
;*[http://www.phpwact.org/pattern/model_view_controller MVC overview] | ;*[http://www.phpwact.org/pattern/model_view_controller MVC overview] | ||
Line 56: | Line 71: | ||
:Articles in Tech Republic that explain in a lucid way the MVC pattern, where it is best used and couple of its disadvantages. | :Articles in Tech Republic that explain in a lucid way the MVC pattern, where it is best used and couple of its disadvantages. | ||
;*[http://www.kvcindia.com/mvc.htm Another MVC overview] | ;*[http://www.kvcindia.com/mvc.htm Another MVC overview] | ||
Line 67: | Line 78: | ||
:It defines the MVC design pattern and explains the concept and how it helps simplifies the developer’s work and also improves the maintainability of the code | :It defines the MVC design pattern and explains the concept and how it helps simplifies the developer’s work and also improves the maintainability of the code | ||
===="Implementation Specific" Websites ==== | ===="Implementation Specific" Websites ==== |
Revision as of 20:53, 28 October 2007
Model/View/Controller Websites Overview
Topic
Model/view/controller. There are literally hundreds of pages describing MVC on the Web. If someone wants to learn about it, what should (s)he do? Look at the first few hits in Google? I expect we can do better than that. Write a review of the MVC sites on the Web. Which are best for learning about the concept? Which have the most instructive examples? Which are best for explaining how to use the pattern in Ruby and Java? If you choose this topic, you should be sure to peruse at least several dozen sites.
Introduction to Model/View/Controller (MVC)
This is an architectural pattern adopted in software engineering. Generally, complex computer applications deal with large amount of data in conjunction with the functionality accessing this data. This generally becomes difficult to handle. Hence the programmer prefers to separate the functionality and data (model) from the user interface (view). This technique is very useful since any changes made to user interface may not affect the functionality of the program and vice versa. The data may be reorganized without making any changes in user interface. This is accomplished by decoupling data access from data presentation and user interface by the introduction of an intermediate component named controller.
The application is decoupled into three layers that would allow flexibility and reuse:
Model: This is the domain-specific representation of information where the application operates. It knows about all the operations that can be used to transform this information. But it has no idea how these operations are invoked.
Controller: This layer responds to the user (user inputs) which may invoke changes on the model. More specifically as mentioned by “Martin Fowler” in his book “Patterns of Enterprise Application Architecture” in a lucid way “Controller takes user input, manipulates the model and causes the view to update properly”
View: This layer provides the user interface element. This is the user-visible view of the model where the information is presented in a domain-specific and user-friendly way.
The MVC architectural pattern is very useful for the purpose of web development applications. One of the main purpose it serves is the separation of concerns. Hence, code is cleaner and easier to understand. The other advantage is reusability. The model can be enhanced in order to improve the functionality of the code with very minimal changes to the controller or view.
Categories of Websites
There are many sites available online about MVC which are very useful to a newbie. Certain websites provide proper pictorial representation and conceptual view of architectural pattern while some provide insight into the interaction between the different layers (i.e. model, controller and view). The websites can be categorized into two broad divisions, "Basic Concept", "Implementation-Specific" and "Examples :
"Basic Concept" Websites
Websites dealing with the concept of MVC as a design pattern :
"MVC Explained with an Example"
Any concept explained through an example is better understood than just theoretical description.Thus, while categorizing websites higher priority is given to those which explain MVC with an example.
- This site provides the perfect place for a novice of MVC to start. This was written in a conversational style and easy to understand. As we proceed with the blue arrows provided on the right bottom corner or the right-top corner, the author slowly develops MVC concept and explains it through a very simple instructive example of "Heart-Beat".
- Example: The heart-beat example consists of the interface as shown below .
This particular example creates 2 separate Java windows for view and controller.After the details how this example is implemented, the author again explains the concept of MVC with respect to the example.
- Starting off with a one line description of MVC and with a "Toggle button" example, this chapter "The Model-View-Controller Design Pattern" from the book "Essential ActionScript 2.0" provides a very instructive explaination of MVC design pattern.The responsibilities of the MVC are elaborated with a running example of a Clock.
This site gives 2 examples, "Toggle" and "Clock", second one being the running example across the excerpt.This example explains the responsibilities of each model,view. It also justifies the usage of MVC with the example which gives us a better insight into the MVC architecture as a whole.
- http://ist.berkeley.edu/as/ag/pub/pdf/mvc-seminar.pdf Seminar pdf on MVC
- This provides a brief info on the history of design patterns and in particular MVC. The seminar proceeds to provide a brief introduction to MVC and then proceeds to its example of "Student_Information".It then uses this example to explain in detail the concept of each of the Model, View and Controller. It also provides information about various technologies available for implementing MVC.
- This pdf provides a application Student_Information as an example of MVC. In this application, the view displays the info, the model stores the relevant information and the controller provides the relevant API's needed for receiving user_input and updating the model appropriately.
- This page, which is part of a tutorial, provides very basic definition of MVC and is accompanied by an instructive example of a "Spinner".
- This example explains how the data in the model is displayed by the view and how an "event action" is recognized by the controller which modifies model as required. It also briefly introduces the concept of multiple controllers modifying the same model.
- This site provides a detailed overview of MVC pattern. It explains the different layers and relationship among them. It discusses the importance of structuring views, controllers and models. It contains information about the benefits and drawbacks of MVC along with the irrelevant situations where MVC will not be helpful.
- Articles in Tech Republic that explain in a lucid way the MVC pattern, where it is best used and couple of its disadvantages.
- The site is important for understanding the basics of MVC architecture. It provides an explanation about the advantages of using MVC architecture.
- It defines the MVC design pattern and explains the concept and how it helps simplifies the developer’s work and also improves the maintainability of the code
"Implementation Specific" Websites
The following sites illustrate the implementation of MVC in different programming languages like SmallTalk (MVC was originally created for this), Java, Ruby, ASP .NET etc.
- This provides the paper by Steve Burbeck, who initially proposed the concept of MVC for Small Talk programming. It provides overview of how to use to MVC for application programming in Smalltalk. It discusses the communication within and between the 3 layers of MVC. It contains information about existing view hierarchy. Some of the existing views are browsers inspectors and debuggers.
- This site gives a simple example of Temperature Control system implemented in java using the Observer and Observable ( these classes have been defined in java in order to implement the MVC architecture in Java) .This site explains in a very instructional way of how to implement MVC in java.
- This site highlights the importance of MVC patterns and its application in many GUI-based applications, client interfaces, and widget toolkits for manipulating and storing data for the end users. Java’s Swing toolkit is a perfect example. The site explains the implementation of MVC in swing. It provides a listing of all components in the model interface. There is a sample code that would help a user to see the functionality of all examples.
- This poses a simple situation where the MVC design pattern can be applied and used to solve the problem using JSP’s to render the views, Servlets as controllers, EJB as models
- This is a very detailed instructional tutorial aimed at developing a MVC CRUD (Create, Read, Update, Delete) application in Ruby on Rails
- This is a blog entry on MVC through the viewpoint of a Ruby on Rails developer defining MVC and giving minor details as to how MVC is implemented in Ruby on Rails.
- This is an article on the Ruby on Rails official website defining the MVC usage in Rails along with links to articles within the same website for better understanding of MVC.
- This is a free download of pdf format of a book “Build your own Ruby on rails applications” by Patrick Lenz. This free pdf download expires by initial days of December//'2007//. This book provides a very wonderful development from the basics of Ruby to Ruby on Rails(RoR) and the MVC architecture explained and shown how it is embedded in RoR. This comes in conjunction with easy to learn illustrations
- The site provides a detailed but a simple overview of Model View Architecture with ASP.Net. It has pictorial representation of the MVC Framework. The picture will help the user to see the implementation of MVC and helps provide understanding of interactions present in MVC. Moreover there is an example of simple web site development to authenticate the user’s name and password by comparing the data with the database.
- The website explains the application of MVC’s 3 Tier architecture for web development using PHP. It gives a comprehensive view of how to blend MVC architecture with Object oriented capabilities of PHP. It highlights the importance of reusability of code which is one of the most important advantages of MVC architecture.
- This site will help a new user to realize the importance of Model View Architecture. It mentions the problems faced by programmer who do not implement this 3 tier architecture and how the problems are resolved using MVC architecture. There is a section where they discussed about the testability which is greatly enhanced by employing this architecture. It also contains information about its benefits and liabilities.
- This site is an extension to earlier site and provides detailed explanation about the usage of MVC architecture in Java’s Swing. This site is for the advanced users who need to apply MVC in visual programming.
- This provides pictorial representation of applications of MVC in Java. It contains images along with explanation for the MVC pattern used in Java explaining MVC and how is it integrated with JSP and struts in Java.
- This site discusses MVC usage in web based development particularly in .NET and AJAX framework.
The sites mentioned above are very useful for several programmers such Java, PHP, Smalltalk programmers. It provides a background for new users who would like to implement design patterns hand in hand with software engineering techniques. Most of the sites explain the MVC as a part of implementation of MVC in their specific software or application. Only a few sites actually deal with the concept illustrating it in a lucid way with simple instructional examples.