First of all, an admission… My name is Ijonas, I used to be a Java programmer. I’ve been clean for a year and a half. So much for my “Java Anonymous” meeting.
In that period I’ve
been experimenting and pondering about Ruby and of course RubyOnRails. During such ponderings I’ve pondered why so many experienced Java programmers are jumping ship onto duck-typed languaged such as Ruby and Python (of which I’m a massive fan).
I’m going to write a bunch of posts about Ruby and the impact on solving certain class of computing science problems, that I believe are now more readily or more elegantly solvable – hence my interest in the Ruby language.
But first I thought I’d share with you, what I think is possibly the easiest, quickest, and dirtiest way of getting a taste of Ruby and Rails.
First of all… tooling.
Now… I wouldn’t bother buying any books until later… I started off with books, but I find screencasts far better in conveying relevant & concise information.
With that in mind I recommend you purchase the following screencasts:
Both are from PeepCode, last about an hour, and cost $9 each. Well worth it. I recommend starting with Rails as opposed to “Pure Ruby”, because that way you get to see some of Ruby’s magic applied in the familiar setting of building a webapp. Coming from Java, it’ll be quiet a refreshing experience – no more xml deployment descriptors.
Having watched both screencasts, you can start building Rails websites with some competence. However, you’ll run into quiet a few “How do I do that ?” questions early on, such as “How do I authenicate visitors to my site?”. And before you head off to Amazon or your local bookstore to buy a Rails Cookbook… I recommend you take a look at Railscasts, which is a free (donations welcome) video podcast providing really helpful solutions to common probems.
Next… you may want to take a look at how Ruby works underneath the covers and how some of its magic manifests itself in such advancements as domain-specific languages (DSL).
Having spent many years programming Java and C#, I found that the recent advancements in test-driven development, mock objects, continuous integration are all worthy pursuits but often these advancements fought with the friction caused by stronly typed languages, i.e. all that test code I was writing was pretty verbose and clunky. Ruby’s take on the aforementioned pursuits and approaches, is positively refreshing and enjoyable.
If you’ve ever questioned why the hell you should write a unit test before the implementation itself, take a look at RSpec. RSpec is another DSL, like Rails is a DSL, this time to facilitate the writing of specification, i.e. the expected behaviour of a software programme. First you describe how your app should behave, then you write the behaviour… It takes a few moments to get your head around why you would want to do so… but then the penny drops… and once again its magical! For a great intro into RSpec I can recommend another Peepcode screencast:
Now if you’re anything like me… Java programmer or C# programmer… many years writing Enterprise applications… lots of XML… You probably know most of what there is to know about OO programming. Classes, interfaces, and object instances are your staple day-in day-out building blocks. You know about inner classes and anonymous methods but only use those if the moon is particularly blue.
Ruby’s take on “OO” borrows from many different OO languages and to fully appreciate some of the magic and how to cast your own Ruby spells, you need to look at Ruby’s object-oriented basics. To that end, I recommend downloading all five episodes (2.5 hours) of:
from the guys at Pragmantic Bookshelf, which will set you back a grant total of $25.
Consuming all this information will take some time… If you’ve got a “day job” that needs to pay the bills… you’ll probably take a week or two to really sift through and appreciate what amounts to a couple of days of screencasts.
All the screencasts I’ve mentioned are of the highest quality and provide amazing value for money… Far more so than the books I’ve purchased.