About Ruby on Rails

Ruby on Rails

What is Ruby on Rails and what are its Features?

Ruby on Rails, also referred to as Rails, is an open-source web development framework. It is written in Ruby and focuses on the use of popular software engineering patterns. These patterns are Convention over Configuration, Active Record Pattern, Don’t Repeat Yourself, and MVC. Rails was developed in 2003. It has been extended by its core development team and over 3,400 developers.

What is Ruby

Ruby is a programming language, developed more than two decades ago. Similar to C or Java, it is a general-purpose programming language, but it is mostly used in web programming.

What is Rails

Ruby on Rails is a software library that works as an extension over Ruby. It was created by David Heinemeier Hansson, as a software code addition to Ruby. At the technical level, Rails is a package library which is installed through the command-line interface. It works as a platform for developing websites. It creates conventions coded as Rails API for easier and faster collaboration and regular maintenance. The API is well documented online. When someone learns Rails, it is about learning how to use Rails conventions and the API.

Rails brings together the Ruby programming language, JavaScript, HTML and CSS for creating a server-side web application.

Main Features of Ruby on Rails

Ruby on Rails helps in improving developer productivity. The main features of the framework are as following:

  • MVC Model – Rails has been developed on the MVC model that allows data to be separated from its presentation.
  • Convention over Configuration – Rails is free from any XML config files, but has basic programming conventions that could be used for specifying the configuration parameters.
  • Common Task Libraries – Rails has a number of libraries for simplifying the coding of common programming tasks. Examples of these would be managing sessions and validating forms.
  • Database Access Library – Rails has a database access library known as “Active Record.” This makes it simpler to handle data in databases. The library is capable of automatically mapping rows to objects and tables to classes.
  • Ajax Library – The Rails platform has an extensive library containing Ajax functions. You can use Ruby code for generating Ajax code. The connected Java scripting gets automatically generated.
  • Debugging – Rails has elaborate error logs that make it easier to debug programs.
  • Components – You can use components for storing reusable code. It is possible to include components for modularizing templates.
  • Custom URL – It is possible to develop custom URLs using Rails. You can also create SEO friendly URLs.

Why developers use Ruby on Rails

Rails was developed on a framework that was created for providing real-world web applications. It has been regularly improved, changed and extended by its community and core team. The main issues addressed by Ruby on Rails are as following:

  • Faster Web App Development – Ruby on Rails already has existing directory architecture in place. Developers seeking to build a web app fast will find this framework to be useful. Its architecture is based on the MVC model. It has many code generators. It has choices already built like JavaScript library, ORM and testing support. Developers may not agree with all the available choices, but they can find something that works for most of their projects. Then, they can modify as per their requirements.
  • Minimal Human Error – With configuration files, you have additional options for human error. Once you have learned logical conventions, they can help in avoiding mistakes such as mistyping a class or file name.
  • Long-term Maintenance – Migrations provide you different ways for moving data forward with changes in code. This happens in almost all applications, but it is something that is not found in most of the platforms. All the parts of the web application can be separated into directory hierarchy. There can be areas for configuration, database and testing. This further helps with the long-term maintenance of programs.
  • Best Practices – Another reason why Rails is so popular with so many developers is because it encourages and pursues best programming practices. One of the best examples of this approach is that Rails has been created for test-driven development.
  • Recognizing Different Development Modes – Ruby on Rails was developed for having separate settings for different functions. There are different settings for Development, Testing and Production. Usually, this is the case with real-world applications, but other platforms don’t support it. This requires developers to swap config files to get the same results.

Use of JavaScript Libraries

There are many more reasons why Rails is so widely accepted in the developer community, but this one clearly stands out from the rest. The framework makes extensive use of JavaScript libraries Script.aculo.us and Prototype for Ajax. Having initially used SOAP for its lightweight features, Rails switched to RESTful web services. The latest version of the platform uses Unobtrusive JavaScript for separating the web page functionality from its structure. Prototype could be replaced with jQuery or CoffeeScript.

Need more information? Check out these sources.

SitePoint

Practicing Ruby

Getting Started With Ruby On Rails