On the Rails

Unless you’ve been hiding away on a desert island for the past year or so, you’ll have heard the huge noise that Ruby – or, more specifically, Ruby on Rails (RoR) – is making in the web development world. It is, according to its proponents, the only possible way to develop websites these days; if you’re using anything else, you’re insane, your projects will take ten times as long and never get finished and, in short, you’re going the way of the dinosaur.

On the Rails

Of course, every time a new programming language gains any sort of foothold in the market, its proponents say it’s the best thing since sliced bread. The interesting thing about Ruby, though, is that it isn’t a new language – it’s been around for more than ten years. What’s brought about this massive recent popularity is the development of Rails, a web application framework that (at least according to its fans) dramatically reduces the time needed to develop websites. So let’s talk a little more about the language, the framework and then, probably of most interest to readers of this column, some of the issues involved in deploying RoR on your web servers.

A gem of a language

Ruby is indeed a lovely little language. It’s completely object-oriented so absolutely everything is an object, even simple things like numbers, which means you can write wonderful little bits of code like:

var = 3.days.from_now

What’s going on there? Well, 3 is a fully fledged object and we can access its days method, which gives us a date object, whose from_now method we can then access to give us a date three days from now, which we store in the variable var. Ruby’s proponents claim that it makes programming fun, and at the risk of sounding like rabid fanboys we’d have to agree.

Ruby was developed over ten years ago by a Japanese programmer named Yukihiro Matsumoto, Matz for short. It’s an interpreted language, which he developed as an alternative to scripting languages like Perl. While somewhat popular in Japan, it remained fairly obscure elsewhere until a company called 37 Signals (www.37signals.com), essentially a small group of geographically diverse programmers, decided to adopt it because they liked its features, and because they found it fun. One of the team, David Heinemeier Hansson (or DHH) created a web framework called Rails in which to develop a web application called Basecamp (www.basecamphq.com), and it’s Rails that really popularised Ruby.

Rails is a web application framework based on the MVC (Model, View, Controller) paradigm pioneered in Smalltalk. Without getting too technical, this involves splitting your code into three parts: the user interface (view), which is kept rigorously separate from the data (model) and the functions that work on the data (controller). In a web application, the controller handles requests from the browser, the model contains all the business logic and the view sends display output back to the browser. Rails allows you to build quickie applications and yet is strong enough to tackle complex ones too – it isn’t a toy. Probably the smartest thing the developers did to encourage the adoption of Rails was to put together a 15-minute video demo (www.rubyonrails.org) that follows the creation of an entire web application, which caught the imagination of developers around the world (even though Rails wasn’t yet at version 1). It’s matured a little now and, although by no means perfect, it’s extremely capable and used by thousands of developers around the world to create large, complex applications.

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.

Todays Highlights
How to See Google Search History
how to download photos from google photos