Ruby on Rails the Next Generation

Why is it the next generation? because it is said to be the replacement  of Java or lets just say the new generation.

It is open shortened to Rails or RoR and  its an open source web application framework for the Ruby programming language.It is intended to be used with Agile development methology which is used by web developers for rapid development.

Some of its history is that Ruby on Rails is extracted by David Heinemeier Hansson from his work on Basecamp, a project management tool by 37 signals now a web application company. He First released Rails as open source in July 2004 but did not share commit rights to the project until february 2005. In August 2006 the framework reached a milestone when Apple announced that it would ship RoR with Mac OS v10.5 “Leopard” which wad released in October 2007.

Like many contemporary web frameworks, Rails uses the Model-View-Counter (MVC) architecture pattern to organize programming

Several Ruby on Rails Feartures are the Following:

Convention over Configuration

Rails has sensible defaults for every aspect of a web application. Following the conventions, you can write a Rails application, using less code than most other web application frameworks. If you need to override the conventions, it’s also easy with Rails.

Taking advantage of the built-in defaults of the Rails framework has a wide range of advantages over making up your own. One of the biggest is that it makes it easier for other programmers to understand your code (and for you to as well, if you haven’t looked at in a while.)

Don’t Repeat Yourself (DRY)

Every piece of knowledge in a system should be expressed in just one place. From a coding perspective, the means you should not find yourself writing the same lines of functionality in multiple locations within the same application, including in more than one view template. Logic that is repeated should be consolidated into one location.

There are a number of Ruby scripts and libraries, such as towelie, that can be utilized to improve the DRY-ness of an existing code base.

Fat Model, Skinny Controller

Most of your application logic should be contained in your models, rather than your controllers. Similarly, views should have a minimum of ruby code and more involved logic, such as complex formatting, should be extracted to helpers. See how to refactor your code at Skinny Controller, Fat Model.

REST interface

REST is a commonly-utilized pattern for web applications - organizing your application around resources and standard HTTP verbs is the fastest way to go. Ruby on Rails provides extensive support for REST patterns by default, making it often the easiest design pattern to employ when using the Rails framework. If you are developing an application and finding that you have to manually create many of the routes and methods for a particular class, it may be worth examining if there is a more RESTful way to implement it. Using scaffolds and Rails metaprogramming (e.g. routing) will also generally encourage REST pattern use.

Write Good Tests

Rails comes with an integrated testing framework out of the box that supports common testing methods including unit and integration testing as well as fixtures. Having reliable tests will help a programmer tremendously when integrating new features or refactoring code – if you have appropriate testing coverage, you can immediately detect if a new change has broken any existing functionality.

A methodology that makes testing central to software design and development, Test Driven Development (TDD), has become increasingly popular. At its most rigorous, TDD can mean writing a suite of unit and integration tests (possibly based on use cases or other requirements documents), and then coding the actual web service to progressively satisfy all of those tests. Although this is definitely a viable approach and is of high value in “mission-critical” type projects, a dogmatic adherence to this development pattern may increase overhead and reduce the ability to make nimble changes in the design of the application, as each change from the original design will first require a corresponding change to the test suite.

Whenever a generator creates model or controller classes, it will also create test classes for you. These test classes will be stubs-only – you will need to add in the appropriate test functions to make them useful.

Programmers new to the platform will benefit greatly from learning about the various testing capabilities of the Ruby on Rails environment.

Automate tasks

Your Rails project comes with many scripts and generators, which allow you to solve many common tasks in one line in the console. You can start the server, migrate the database, run tests, measure performance and much more with the help of Rake tasks and scripts.

One such script is called generate and is used to create all kinds of things like: A new and ready-to-run Rails application or a complete interface to create, read, update and delete models (scaffold).

Leave a Reply

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <code> <em> <strong>