Learning Rails
Posted at 14:00 on 12 February 2007
Historically, I have often adopted something of an ad-hoc approach to learning new programming languages. I tend to sit down with a specific project in mind, thrash around the documentation till I find what I’m looking for, and take it from there. It tends to be pretty tough going at first, but I tend to find I can pick up the basics of the language pretty quickly that way.
The only problem with this approach is that you end up with a patchy knowledge of the capabilities of the language and platform. I noticed this to quite a striking effect when I took my certification exam in ASP.NET. I discovered that there were facets of the framework, such as data binding, that I had previously completely overlooked, as well as a raft of best practices and principles to tap into. It’s also easy when you adopt an ad-hoc approach to learning a framework to miss out on some of the gotchas and pitfalls of a platform, as anyone who has encountered and attempted to eliminate the side effects of PHP\\\\\\\\’s notorious magic quotes will testify.
With Rails I’m trying a different, much more systematic approach. I bought myself a copy of Agile Web Development with Rails, which is more or less the official Rails manual (some people reckon the online documentation is a bit obtuse precisely to help sell the book) and I’m working my way through it. My intention is to work my way right through it before writing any serious code, by which time I should know what the framework has to offer and what it doesn’t, as well as what I need to look out for.
Developing Rails applications with Eclipse using RadRails
I’ve recently taken to using Eclipse for my work in languages other than .net (for which I still use Visual Studio). If you’ve never heard of it before, Eclipse is an open source integrated development environment written in Java. I’d never made a lot of use of it before — I always thought of it as a purely Java thing, and as I haven’t done a great deal of Java in the past, I never fully explored its capabilities. However, when I stumbled on a PHP plugin for Eclipse last week, it roused my curiosity, so I looked around to see what else was available. Sure enough, there are plugins for a whole raft of other programming languages such as Python, Scheme, Fortran or even OCaml (does anyone other than academics actually use OCaml?), and, as you would expect, Ruby on Rails.
The Rails plugins for Eclipse (there are two that you need to install) are the Ruby Development Tools and RadRails. It seems it’s the way to go for Rails development: you can start and stop your WEBrick servers, and access and run all your generators and Rake tasks from within the IDE without having to launch a separate command line window. And of course, it has all the other features you’d expect of an integrated development environment: syntax highlighting, source folding, document outlining, breakpoints and stepping through your code, and Subclipse to allow you to integrate it with your Subversion repository. Some of the Eclipse terminology took a little bit of getting used to at first, and getting RadRails up and running took a little bit of tweaking to get the settings right, but once you get it sorted out, it’s fairly straightforward.