Wednesday, September 8, 2010

What is Rails?

Rails is a web application development framework written in the Ruby language. It allows you to write less code while accomplishing more than many other languages and frameworks.Rails is opinionated software. It makes the assumption that there is a “best” way to do things, and it’s designed to encourage that way.

Some key points regarding rails is below

  • An extremely productive web-application framework.
  • Written in Ruby by David Heinemeier Hansson
  • You could develop a web application at least ten times faster with Rails than you could with a typical Java framework
  • An open source Ruby framework for developing database-backed web applications
  • Your code and database schema are the configuration
  • No compilation phase required

The Rails philosophy includes several guiding principles:

  • DRY – “Don’t Repeat Yourself” – suggests that writing the same code over and over again is a bad thing.
  • Convention Over Configuration – means that Rails makes assumptions about what you want to do and how you’re going to do it, rather than requiring you to specify every little thing through endless configuration files.
  • REST is the best pattern for web applications – organizing your application around resources and standard HTTP verbs is the fastest way to go.
This will be discussed in depth later.

Rails Strengths

Rails is packed with features that make you more productive, with many of the following features building on one other.

1) Metaprogramming

Other frameworks use extensive code generation from scratch. Metaprogramming techniques use programs to write programs. Ruby is one of the best languages for metaprogramming, and Rails uses this capability well. Rails also uses code generation but relies much more on metaprogramming for the heavy lifting.

2) Active Record

Rails introduces the Active Record framework, which saves objects to the database. The Rails version of Active Record discovers the columns in a database schema and automatically attaches them to your domain objects using metaprogramming.

3) Convention over configuration

Most web development frameworks for .NET or Java force you to write pages of configuration code. If you follow suggested naming conventions, Rails doesn't need much configuration.

4) Scaffolding

You often create temporary code in the early stages of development to help get an application up quickly and see how major components work together. Rails automatically creates much of the scaffolding you'll need.

5) Built-in testing

Rails creates simple automated tests you can then extend. Rails also provides supporting code called harnesses and fixtures that make test cases easier to write and run. Ruby can then execute all your automated tests with the rake utility.

6) Three environments

Rails gives you three default environments: development, testing, and production. Each behaves slightly differently, making your entire software development cycle easier. For example, Rails creates a fresh copy of the Test database for each test run.

No comments:

Post a Comment