CSC/ECE 517 Fall 2007/wiki2/3 rl: Difference between revisions
Line 22: | Line 22: | ||
#[http://www.informit.com/guides/content.aspx?g=java&seqNum=117&rl=1 http://www.informit.com/guides/content.aspx?g=java&seqNum=117&rl=1] : Complete code example using Servlets as the controller, JSP files as the view, and JavaBeans as the model. | #[http://www.informit.com/guides/content.aspx?g=java&seqNum=117&rl=1 http://www.informit.com/guides/content.aspx?g=java&seqNum=117&rl=1] : Complete code example using Servlets as the controller, JSP files as the view, and JavaBeans as the model. | ||
== Best Sites for How to Use the Pattern in Ruby and Java == | == Best Sites for How to Use the Pattern in Ruby and Java== | ||
Ruby on Rails has built-in support for Model View Controller. In fact, it is impossible to write a Rails application without following the pattern. The Ruby links below are introductions to writing rails applications that have a section dedicated to MVC. | |||
#[http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/ http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/] : This article gives the details on how to utilize the built-in features of Ruby on Rails to create a web application using MVC. | |||
#[http://rails.homelinux.org/ http://rails.homelinux.org/] : Four Days on Rails is a 40 page pdf that takes you through learning the basics of rails. It includes both a description and code example for the model, view, and controller. | |||
However, since Java does not have built-in support for Model View Controller, you must design your Java applications keeping MVC in mind. The following links detail the steps required. | |||
#[http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/app-arch/app-arch5.html http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/app-arch/app-arch5.html] : This is the design document for the pet store sample that comes built-in with Java EE. It goes into a lot of detail about how the MVC was used to design this sample. This page provides an excellent resource to understand the benefits of using patterns while working on a project's architecture. It bridges the gap between the theoretical concepts of the pattern and its practical implementations. | #[http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/app-arch/app-arch5.html http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/app-arch/app-arch5.html] : This is the design document for the pet store sample that comes built-in with Java EE. It goes into a lot of detail about how the MVC was used to design this sample. This page provides an excellent resource to understand the benefits of using patterns while working on a project's architecture. It bridges the gap between the theoretical concepts of the pattern and its practical implementations. | ||
#[http://cristobal.baray.com/indiana/projects/mvc.html http://cristobal.baray.com/indiana/projects/mvc.html] : A detailed introduction to the use of MVC with a Java view point which spans several pages, complete with source code. Warning: This site throws many pop ups, so keep your pop up blocker handy. | #[http://cristobal.baray.com/indiana/projects/mvc.html http://cristobal.baray.com/indiana/projects/mvc.html] : A detailed introduction to the use of MVC with a Java view point which spans several pages, complete with source code. Warning: This site throws many pop ups, so keep your pop up blocker handy. | ||
Revision as of 21:55, 28 October 2007
Wiki 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.
Model View Controller
"Model-view-controller (MVC) is an architectural pattern used in software engineering. In complex computer applications that present a large amount of data to the user, a developer often wishes to separate data (model) and user interface (view) concerns, so that changes to the user interface will not affect data handling, and that the data can be reorganized without changing the user interface. The model-view-controller solves this problem by decoupling data access and business logic from data presentation and user interaction, by introducing an intermediate component: the controller." Taken from Wikipedia
Best Sites for Learning the Model View Controller Concept
We have compiled a list of the following sites to introduce the Model View Controller concept. Model View Controller can be applied to a broad range of applications and we hope the following sites will give you insight into this pattern.
- http://java.sun.com/blueprints/patterns/MVC-detailed.html : This is a very brief introduction to the MVC concept, ideal if you are in a hurry :). I really like the illustration they used, it delimits the responsibilities of the components very well. Discusses a few Java and web technologies, but no prior knowledge of these is necessary.
- http://ootips.org/mvc-pattern.html : Nicely written introduction; however, it has ascii-art diagrams.
- http://www.oreillynet.com/onjava/blog/2003/07/new_way_to_learn_mvc_view_a_si.html : The most innovative way to learn about MVC, through a song. Yes you heard it right, I would recommend this to everyone just because of the hilarious lyrics. Enjoy! (Be sure to press "Listen" and not the "Download this song" link.)
- http://www.adobe.com/devnet/flash/articles/mv_controller.html : A fantastic article that details the three components of MVC, benefits of the pattern, how the classes of MVC communicate, and class responsibilities.
- http://www.perlmonks.org/?node_id=402070 : An easy introduction to MVC with a handy sequence diagram example.
Best Sites for Model View Controller Examples
Sometimes seeing a few examples can be really helpful. So here they are:
- http://www.enode.com/x/markup/tutorial/mvc.html : This is an awesome introduction to the concept. Short, sweet and to the point explained with the help of a contrived spinner example. This site does not give many details but is really good to get you started.
- http://csis.pace.edu/~bergin/mvc/mvcgui.html : This article is written very well. It gives a detailed example of a temperature gauge, complete with source code in Java. I especially like it when the author explains how the components are interconnected. It really helps in understanding the communication between the model, view and controller, as introduced in many of the MVC concept websites above.
- http://www.caucho.com/articles/jsp_templates.xtp : An extremely detailed example of how to build a simple guestbook in JSP using the MVC pattern.
- http://www.informit.com/guides/content.aspx?g=java&seqNum=117&rl=1 : Complete code example using Servlets as the controller, JSP files as the view, and JavaBeans as the model.
Best Sites for How to Use the Pattern in Ruby and Java
Ruby on Rails has built-in support for Model View Controller. In fact, it is impossible to write a Rails application without following the pattern. The Ruby links below are introductions to writing rails applications that have a section dedicated to MVC.
- http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/ : This article gives the details on how to utilize the built-in features of Ruby on Rails to create a web application using MVC.
- http://rails.homelinux.org/ : Four Days on Rails is a 40 page pdf that takes you through learning the basics of rails. It includes both a description and code example for the model, view, and controller.
However, since Java does not have built-in support for Model View Controller, you must design your Java applications keeping MVC in mind. The following links detail the steps required.
- http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/app-arch/app-arch5.html : This is the design document for the pet store sample that comes built-in with Java EE. It goes into a lot of detail about how the MVC was used to design this sample. This page provides an excellent resource to understand the benefits of using patterns while working on a project's architecture. It bridges the gap between the theoretical concepts of the pattern and its practical implementations.
- http://cristobal.baray.com/indiana/projects/mvc.html : A detailed introduction to the use of MVC with a Java view point which spans several pages, complete with source code. Warning: This site throws many pop ups, so keep your pop up blocker handy.