|
There's been quite a bit of buzz recently about a new technology called
Ruby on Rails that's revolutionizing web development. This article will provide a
little background on Ruby on Rails, and provide some tips on how to get started using
this new technology.
Ruby is a programming language originally developed in Japan. It's generally
classified as a scripting language, like Perl and Python, because 1) it's an interpreted
language, and 2) it's a typeless language. It's also an object-oriented language; in fact,
unlike some other languages, everything, including even the simplest types, is an object.
What has really taken the development realm by storm is Rails, a framework
for web development that has been implemented in Ruby. Rails enforces a well-defined structure
on web sites, and then takes advantage of that structure to automate finding all of the
different components of a complex web site. This allows Rails to support a very nice
Model-View-Controller (MVC) implementation, with virtually none of the complex configuration
required by other technologies such as Java's Struts framework.
Even more impressive, Rails features ActiveRecord, a facility that
provides object-relational mapping capabilities for the framework. With ActiveRecord,
developers relate models (objects) to database tables, and also define the relationships
between models. ActiveRecord then automates all functionality for retrieving data from the
database, searching based on various criteria, database updates, etc.
Now, object-relational mapping isn't new. For example, Hibernate is a powerful
object-relational mapping technology that's available in Java. But Hibernate requires
extensive configuration, while ActiveRecord eliminates the majority of configuration by
interrogating the database automatically to retrieve required information, such as the names
of the columns in a table. The end result is that ActiveRecord eliminates most of drudgery
involved in interacting with a database.
So, what's the easiest way to begin learning Ruby on Rails? It comes
down to to three things:
- Documentation
- InstantRails
- RadRails
Documentation
To
get started with Ruby on Rails, the first thing you need to do is buy the
Ruby on Rails bible, which is a thick book called Agile Web Development With Rails, by
Dave Thomas and David Heinemeier Hansson. This book contains everything that you need to know
about this exciting framework. It begins by guiding the reader through the development of
a fairly sophisticated web application, before delving much deeper in later chapters.
Make sure that you buy the second edition. Even
though Rails is relatively new, the sheer pace of development surrounding Rails has
necessitated a second edition barely a year after the first one came out.
InstantRails
InstantRails is a pre-packaged development environment for Ruby on Rails. It
contains Ruby on Rails, MySQL, Apache, Mongrel and PHPMyAdmin. All of the elements are already
configured, so all you have to do is get the InstantRails download, unzip it in a folder and
run it.
InstantRails provides a handy control panel, which is shown below. Using the
control panel, users can manage web applications, launch PHPMyAdmin, launch a Ruby console
window, etc.
Within the InstantRails package, Apache functions as the web server. Mongrel is
a connector, a component that allows Apache to interact with Ruby. MySQL is a fully configured
relational database system that can be used in Rails applications. To make database-related
activities easy, PHPMyAdmin is provided; this easy-to-use tool provides extensive functionality
for managing mySQL databases.
To download InstantRails, use the link below. InstantRails is hosted by
RubyForge.org, which is also a good place to look for other Ruby-related and Rails-related
software packages.
Be aware that InstantRails is currently only available as a Windows
download. However, since it is composed of open source components, all of which do
work on other platforms such as the Mac, Linux, etc., one can expect that it won't
be too long before this handy tool is available for non-Windows environments.
RadRails
With InstantRails providing the basic platform for developing a Ruby
on Rails web application, it would be nice to have a Ruby-aware editor to assist in the
development process. RadRails to the rescue!
RadRails is an Eclipse plug-in that's customized to support
Ruby on Rails. For those who might be unfamiliar with it, Eclipse is a modular
integrated development environment (IDE) available from the open source community.
It was originally started as a Java-centric tool, but its modular nature has
encouraged the open source community to create a wide variety of plug-ins for it,
of which RadRails is a good example.
RadRails comes in two flavors: A) a plug-in which you can integrate into your
existing Eclipse setup, or B) a stand-alone version of the Eclipse IDE with the Ruby on
Rails functionality already integrated. If you choose B, it works just like InstantRails
... unzip it in a folder and you're good to go. Make sure to set the working directory
to the "rails_apps" directory set up by Instant Rails. Eclipse and RadRails work under
both Windows and Mac.
RadRails can be downloaded at the link below:
Next Steps
Armed with the definitive Ruby on Rails textbook, InstantRails for a
development platform and RadRails for a souped-up editor, developers should have
everything that they need to take Ruby on Rails for an extensive test drive. The next
step is to build some small applications and discover how much time Rails can save
when it comes to building web applications.
|