CSC/ECE 517 Fall 2007/wiki2 1 rl: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
Line 11: Line 11:
===Ruby on Rails===
===Ruby on Rails===


Ruby on Rails, also known as "Rails" or "RoR", is the standard Web application framework for the Ruby programming language.  It is an open source project that was released in 2004, and was created to make web application development quick and easy. Rails attempts to achieve this through several means:
Ruby on Rails, also known as "Rails" or "RoR", is the standard Web application framework for the Ruby programming language.  It is an open source project that was released in 2004, and was created to make web application development quick and easy.  
<ul>
 
<li>'''MVC Architecture:''' All Rails applications use the MVC architecture.  Rails projects are created with a placeholder for each concern, and these concerns always interact in the same standard way.</li>
All Rails applications use the MVC architecture.  Rails projects are created with a placeholder for each concern, and these concerns always interact in the same standard way. Models and controllers are Ruby classes, and views are rhtml files.  The Ruby router directs requests to a particular controller and action based on the URL.   
<li>'''Scaffolds:''' Rails applications can take advantage of scaffolds out of the box.  Essentially, Rails will generate all of the code necessary to do basic database interactions, such as create, read, update, and delete entries.  This allows developers to quickly and easily begin working with their data model, and replace the generated code with customized versions piece by piece.</li>
<li>'''Convention over Configuration:''' Rails uses sensible defaults, so as long as you follow convention, your application can be written with significantly less code and without the great number of configuration files seen in other web applications todayFor example, if you create a model class called ''Product'', Rails will also generate for you a controller class named ''ProductsController'', and will assume that your model is using a database table called ''products''.  You only need to configure the table name if you are using a different value.</li>
<li>'''Don't Repeat Yourself:''' Information about the system should be expressed in only one place.  For example, the names of the columns of a database table need only be contained in the table itselfRails gathers this information through reflection and discovery.</li>
</ul>


===Apache Struts===
===Apache Struts===


Apache Struts is a Web application framework for the Java programming language, used to create Java 2 Platform, Enterprise Edition (J2EE) applications.  It is an open source project that was donated to Apache in 2000. Before Struts was introduced, large web applications were often difficult to maintain due to the commingling of code used for data access, user interfaces, and application flow.  Struts separates these concerns by encouraging the use of the MVC architecture.  Struts provides a controller in the way of request and response handlers, and provides a tag library that developers can use to develop views.  The model is left up to the developer.
Apache Struts is a Web application framework for the Java programming language, used to create Java 2 Platform, Enterprise Edition (J2EE) applications.  It is an open source project that was donated to Apache in 2000. Struts was introduced to encourage the use of the MVC architecture.  Struts provides a controller in the way of request and response handlers, and provides a tag library that developers can use to develop views.  The model is left up to the developer.


===A Comparison===
===A Comparison===
Line 27: Line 23:


==Advantages==
==Advantages==
both have advantages of MVC


Example?
Example?
Line 33: Line 30:


==Advantages for the Developer==
==Advantages for the Developer==
<li>'''Scaffolds:''' Rails applications can take advantage of scaffolds out of the box.  Essentially, Rails will generate all of the code necessary to do basic database interactions, such as create, read, update, and delete entries.  This allows developers to quickly and easily begin working with their data model, and replace the generated code with customized versions piece by piece.</li>
</ul>
<li>'''Convention over Configuration:''' Rails uses sensible defaults, so as long as you follow convention, your application can be written with significantly less code and without the great number of configuration files seen in other web applications today.  For example, if you create a model class called ''Product'', Rails will also generate for you a controller class named ''ProductsController'', and will assume that your model is using a database table called ''products''.  You only need to configure the table name if you are using a different value.</li>
<li>'''Don't Repeat Yourself:''' Information about the system should be expressed in only one place.  For example, the names of the columns of a database table need only be contained in the table itself.  Rails gathers this information through reflection and discovery.</li>
==Advantages for the Application==
==Advantages for the Application==



Revision as of 23:58, 22 October 2007

Assignment

Compare Ruby on Rails with Apache Struts. The Apache Struts framework in the Java world occupies a position similar to Ruby on Rails, except that it is not as universally used. Compare the two. Which are the advantages of each for the developer? For the finished application?

Introduction

Ruby on Rails and Apache Struts are both web application frameworks based on the Model-View-Controller (MVC) architecture.

MVC Architecture

MVC separates an application into three components: the model, the view, and the controller. The model maintains the application state; it consists of both the data used by the application as well as the rules surrounding the use of that data. The view generates the user interface, which allows the user to view and interact with the data in the model. The controller takes input from the outside world, interprets the input, and manipulates the model accordingly. Separating these three concerns makes the application code easier to understand, reuse, and maintain.

Ruby on Rails

Ruby on Rails, also known as "Rails" or "RoR", is the standard Web application framework for the Ruby programming language. It is an open source project that was released in 2004, and was created to make web application development quick and easy.

All Rails applications use the MVC architecture. Rails projects are created with a placeholder for each concern, and these concerns always interact in the same standard way. Models and controllers are Ruby classes, and views are rhtml files. The Ruby router directs requests to a particular controller and action based on the URL.

Apache Struts

Apache Struts is a Web application framework for the Java programming language, used to create Java 2 Platform, Enterprise Edition (J2EE) applications. It is an open source project that was donated to Apache in 2000. Struts was introduced to encourage the use of the MVC architecture. Struts provides a controller in the way of request and response handlers, and provides a tag library that developers can use to develop views. The model is left up to the developer.

A Comparison

page 1 of text

Advantages

both have advantages of MVC

Example? advantage: the short and clear URLs, new so not playing catchup on standards (page 2 of book), http://en.wikipedia.org/wiki/Convention_over_Configuration (hibernate) http://www.javalobby.org/java/forums/t65305.html

Advantages for the Developer

  • Scaffolds: Rails applications can take advantage of scaffolds out of the box. Essentially, Rails will generate all of the code necessary to do basic database interactions, such as create, read, update, and delete entries. This allows developers to quickly and easily begin working with their data model, and replace the generated code with customized versions piece by piece.
  • Convention over Configuration: Rails uses sensible defaults, so as long as you follow convention, your application can be written with significantly less code and without the great number of configuration files seen in other web applications today. For example, if you create a model class called Product, Rails will also generate for you a controller class named ProductsController, and will assume that your model is using a database table called products. You only need to configure the table name if you are using a different value.
  • Don't Repeat Yourself: Information about the system should be expressed in only one place. For example, the names of the columns of a database table need only be contained in the table itself. Rails gathers this information through reflection and discovery.
  • Advantages for the Application

    References

    1. Ruby on Rails and J2EE: Is there room for both?
    2. Rolling with Ruby on Rails Revisited
    3. Ruby on Rails
    4. Model-view-controller
    5. CSC517 Lecture 12: Ruby on Rails
    6. Agile Web Development with Rails
    7. Ruby on Rails Wikipedia entry
    8. Apache Struts Wikipedia entry

    See Also