Ruby on Rails

Ruby on Rails

Ruby on Rails Mitchell Craig; Tam Nguyen; Becker Luu; Eliezer Mar Manarang; and Colin Williams University of Calgary SENG 403 Dr. Kremer Abstract—The proceeding document describes the Ruby on web applications. Thousands of web applications around the Rails web application framework. A history is provided, along world have been developed using Ruby on Rails with some with the founding Philosophies and Priciples, Technical Infor- notable examples such as Twitter, Yellow Pages, Github and mation, Notable Applications and a comparison to competitors. A short tutorial is provided as an example. Hulu. Today, the Rails framework is supported by the Rails core team consisting of a dozen members who have been given the keys to the source repository as well as more I. INTRODUCTION than 2,100 contributors to the project. The framework is Ruby on Rails [1] (often referred to as Rails or RoR) supported by a vibrant ecosystem which includes various is an open source web application development framework choices in hosting, tools, editors, conferences, workshops that is written in the Ruby [2] programming language. The and consultants. Ruby on Rails framework is designed to make programming web applications easier by making assumptions on what the III. PHILOSOPHIES AND PRINCIPLES developer requires to get started on their applications. Ruby There are three primary philosophies or principles[4] be- on Rails is a development tool which assists developers in hind Ruby on Rails: Convention over Configuration (CoC), building websites and applications because it abstracts and Dont Repeat Yourself (DRY) and Representational State simplifies the commonly used and repetitive tasks. What this Transfer (REST). means is that the programmers only have to write new code The first key principle is Convention over Configuration. in areas where their application differs from the standard The Rails framework is designed with conventions that tell conventions. Using Ruby on Rails, the programmers are able you how you should structure your code, how to name your to write less code while producing more output than with classes and files and how to organize your databases and other development frameworks. Highlighted in this report tables. The framework makes large assumptions about what is an overview of the philosophies and principles behind you want to do and how you want to do it so that you dont Ruby on Rails, an in-depth look at the technical aspects need to explicitly specify it. The benefit of having these of the framework as well as comparisons to other similar conventions is that it simplifies and reduces the amount technologies. Finally, the report includes a tutorial on getting of code that you actually need to write when developing setup with the Ruby on Rails framework and getting started your web application. What this means when developing is with developing a simple web application. that only the unconventional aspects of the program need to be written. This allows for better productivity and high II. HISTORY OF RUBY ON RAILS efficiency since the repetitive or common tasks are already Ruby on Rails was created in 2003 by David Heinemeier automatically completed for you. Of course, there is the Hansson. Hansson developed the original framework for option to ignore these conventions and structure the code to Rails while he was working on Ruby-based projects for your own preferences but this means that more unnecessary 37signals[3], a web application company. Rails was ex- work is being done. This principle makes Ruby on Rails a tracted from some of Hanssons work on Basecamp, a project bit of an opinionated framework[5] and is largely a reason management tool developed by 37signals. why the framework is named Ruby on Rails. If you decide to Rails was first released publicly released in July 2004 as follow the conventions that have been set out, you will enjoy an open source project. The project had reached a milestone the benefits of using Rails for developing your applications. in 2006 when Apple announced that Ruby on Rails would If you dont conform to the style that the framework was be bundled together with Mac OS X v10.5 Leopard which built on, it may not work well for you. later released in 2007. The second key principle is DRY which stands for Dont The Rails framework is based on established principles Repeat Yourself. This principle suggests that writing the that had been proven successful elsewhere and is focused on same code over and over again is a bad thing. The main practicality which is the reason behind why it has become idea behind the DRY principle is that it promotes the reuse so successful. With the release of Ruby on Rails, Ruby has of code as often as possible rather than duplicating and risen to become a prominent alternative for other classic rewriting similar code in multiple places. Ruby on Rails languages such as PHP and Java for developing websites and follows the DRY principle to help in maintaining clean code and reducing the chance of errors in the code. Having DRY reliable code. Less work and code is required from the code in your program means that changes only need to be developers which results in higher productivity. made at one location rather having to revise changes in all different locations. If an error were to occur, it would be IV. TECHNICAL INFORMATION a lot more traceable and easier to detect the root cause of This section describes Ruby on Rails[7] basic technical the error. Rails is designed with and provides libraries that information: the structure on how it works, classes that are assist in writing DRY code. needed for development, and the framework that it supplies The last principle of Ruby on Rails is REST or Repre- aiding the web application development. Also, some tools sentational State Transfer[6]. This is not one of the primary for deployment of the application is tackled briefly. The in- philosophies of Ruby on Rails but in recent years, the formation stated here are mainly learned/cited from sources Rails community has moved towards following the RESTful [8], [9], and [10] for the system architecture/information and architecture. Unlike the other philosophies of Rails, it is not development tools, and [11] contains the recommended tools a requirement for the application to follow a REST design. for deployment. It is encouraged that developers follow the REST design and the framework provides tools that make it easier to do so. A. Introduction REST is a pattern for making web applications which Ruby on Rails is a development framework for developing organizes the application around resources and standard a web application. Rails offers libraries for development HTTP verbs. With REST, there are three key ideas. The ranging from the user interface up to managing the data and first is proper identification of resources, the second is the processing it. This is why Rails is called a full-stack web manipulation of the resources and the last is to have self- application development framework - usable to create all descriptive messages that are easy to interpret. Resources functionality of a working web application.The availability are often the core model objects in the program. The main of the different libraries and given the founding philosophies idea behind the RESTful design is to identify and manipulate of Rails, which is the basis of a Rails project default con- resources using a standard convention that is self-descriptive. figuration, are giving Rails the ability to automatically link As an example, the following HTTP request, DELETE different aspects and classes of a created project resulting /photos/17 can be easily understood as referencing a photo for the developers ease of use of the system. Though the resource with an ID number of 17. The standard HTTP drawback of following a default configuration for the Rails verb being used in this case is the delete functionality. The framework is that it offers little flexibility on configuration purpose behind using REST in Ruby on Rails is to provide management and design for the developer. The basic features a simplified design pattern that is clear and straightforward. that Ruby on Rails provides for the application development This can be especially helpful if the application being are: [10] developed is an open source project. Following a common pattern like REST for all applications using Rails means that • HTML [12] templating (which involves the view com- all developers will have a good understanding of the coding ponent of the application). style and practices. • Database storage/retrieval (involves the model classes The philosophies and principles of Ruby on Rails are very in the application). closely related within the framework. They all aim towards • User Web browser requests and response (involves the simplifying and making the process of developing web appli- controller classes in the application). cations as simple as possible. Convention over Configuration • HTML form handling. focuses on making the development process straightforward B. Directory Structure and increasing productivity by abstracting the common and repetitive tasks so that the developer only needs to be focus When creating a project on Rails, Rails creates a prede- on the new aspects to be implemented rather than having to fined directory structure to contain the files needed for the worry about the unnecessary conventional aspects. The DRY project to work. Below are the directory names that could philosophy focuses on having to write code only once and be seen in a Rails project, and a brief description of each: reusing it as much possible when that particular functionality [10] is needed. Once again, this increases productivity since it app reduces the amount of code that needs to be written.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us