As I've stated before, my programming language for the year is Ruby. I actually planned on learning Python or Ruby last year, but things didn't pan out. Over the last 6-8 months I've been doing a pretty good job of getting myself on the way to learning Ruby. As with any language the best way to learn it is to write something using it. As we all know Rails has done a tremendous job of bringing people to Ruby. I'm no different. Over the last 6 months I've worked on two Rails projects and in the last week put one of them into production (well almost). Since I'm half way through the year I wanted to put some thoughts down here, mostly for myself, but also for others who might be interested in a .NET dudes impressions of Ruby and Rails.
Before writing a book myself, I bought a good number of books on technical topics that I found interesting. After experiencing what goes into writing a book, I find that I'm much quicker to pull the trigger on books that I think I might find interesting. The amount of work required to get a book out the door is mind boggling to me. As such I've purchased, and read, the following books to help me learn Ruby.
As you can see not all the books are strictly Ruby related. Several are focused on Rails, one is focused on working with Google Maps with Rails, and one is to help me learn to work in my new favorite editor, Textmate.
In addition to reading the above, I've been checking out the source code for a couple of the more popular open source Rails applications as well as some of the more popular plugins. While all of that has been very valuable, nothing is ever as good as actually writing code. As such I've done several projects that I would have traditionally done in .NET in Rails instead.
The first application that I got started with (and which I'm still working on) is an application that helps geographically visualize key individuals within a social network. The data for the individuals in the social network, as well as the data for the connections between individuals, is stored in flat files so I got my first chance to play around with the CSV parsing capabilities of Ruby. I found the
FasterCSV library very useful, and got off to a pretty good start with my first attempt at parsing the CSV files and getting them into my MySql database using my ActiveRecord model objects. After the file parsing was done, I got a chance to build several administrative pages for the site using Rails, as well as the chance to experiment with some very useful plugins such as:
My second application involved setting up a site with paid membership. The site has several administrative functions for the owner of the site, as well as a handful of features for those who sign up to be members such as exclusive downloads, advertising opportunities, and a members only forum. In addition to be able to gain a lot more experience with the inner workings of Rails this project also led me to gain experience with:
So given all of the above, if your still reading, I'm guessing your wondering what I think. In short, I'm becoming a pretty big fan of Ruby as well as Rails. While Rails isn't perfect it does a lot of things very well.
Rails Migrations are the best solution that I've come across for migrating the schema of a database. I can see why large teams run into some trouble with them, but for the projects I've been working on migrations have worked wonderfully. While I'm a big fan of DDD, I also really like ActiveRecord in the right situations. Being able to create a migration, run rake db:migrate, and have the column automatically available in my model without having to do anything makes developing with Rails and ActiveRecord very enjoyable. Rather than dealing with the mundane tasks of writing scripts for adding columns, and then updating the associated data access and model classes, I can focus on the stuff that matters. In addition to migrations and ActiveRecord I'm also fond of ActionMailer and the way that it allows you to create and send email, its far better than what's available in .NET land. Next up, is the MVC structure that Rails uses for building the pages that make up the application/site. I'm a huge fan of MVC/MVP for building UI's so it should be no surprise that I'm also a big fan of Rails implementation of MVC. I really like having a single controller per model object, and having a nice organization to the views used by the controller. I also really like the validation story for Rails.
As I learn new technologies I often times hack my way around until I get a good feel for what I'm doing and how things are supposed to work and be put together. This led to me not writing as many unit tests for certain parts of the applications I was working on. I did test drive most (if not all) of the logic I put into my model objects, but I slacked off a bit when it came to testing the controllers. This is partly due to the fact that I was using scaffolding, and partly due to the fact that I was pushing almost everything into my model objects rather than allowing my controllers to get "fat". As part of the test driving of my model objects I used the built in testing infrastructure, although I still want to checkout
rspec. On my latest project I also began experimenting with
mocha which really helps with the testing of objects that have dependencies.
So given all my recent exposure to Ruby and Rails one has to wonder how I rate it against my native "tongue", .NET. I have to say I've had a lot of fun working with Ruby and Rails. This is in part because its something unfamiliar and I really enjoy learning, but its also because both Ruby and Rails have a way of making developing with them very enjoyable. I haven't enjoyed some of the deployments and such that I've had to deal with, but since I was learning a bit about how to deploy Rails applications on Linux it wasn't as bad as I expected. I'm nowhere near hanging up my .NET toolbelt, but I am going to continue to do a lot of the work that I would have previously done in .NET in Ruby and/or Rails.