This blog is now obsolete. Go to scott.arbeitman.id.au for all new content.

Moving to Ruby Full Time

| Thursday, May 14, 2009

I recently started new job, which has involved near full time Ruby on Rails development. I have previously done some minor projects in Ruby and Rails, but for the most part, I have been using some combination of ColdFusion, Java and PHP for most of my professional career. I thought I would note some of my observations about using Ruby as compared with some of the other languages.

Readability: Ruby is well known as the "glue that doesn't set" meaning that Ruby code remains easy to read, even after a leaving it for a significant amount of time. This is hard to argue with. Anyone who has ever explored a Rails model or read an RSpec test can easily see some of the virtues of Ruby. Compared to most language, Ruby wins hands-down. But, the problem arises when it comes to

What-the-hell-is-going-on-ity: The readability of Ruby comes from its many metaprogramming features. RSpec does a great job of adding the right methods to Ruby classes, as does Rails. But this means that a lot of code or methods are added for you. Control flow and the definitions of methods become difficult to pinpoint. The more simultaneous frameworks you use, the greater chance of confusion. All this while your code remains quite easy to read. But what about trying to debug or add new features. This is where the problems start to creep in. By using the much more verbose Java, we can still have our dependancies documented and explicitly referenced in our code. Yes, this creates noise which makes our code harder to read, but it also leaves breadcrumbs as to what is happening.

Community: This is sometimes overlooked when considering which language to learn. It doesn't just matter the size of a community, but the quality of it. ColdFusion has a relatively small community, but is active and friendly. I can easily name the hot-shots of ColdFusion and I can subscribe to their blogs with too much information overload. In contrast, the Java community is probably too big. Frankly, I wouldn't know where to start when looking for blogs to subscribe to.

Ruby is a funny creature. The Ruby community seems small. On the other hand, the Ruby on Rails community is large. It's rare to find a Ruby programmer who doesn't use Rails. And Rails certainly has its "key people" and finding Rails tutorials and podcasts is pretty easy. You're not likely to find such a wealth of knowledge for most other frameworks like Model-Glue or Spring. But if you're interested in Ruby qua a programming language, you can get a great start here, but good luck after that. This can keep you from writing really excellent Rails code for quite some time, somewhat delaying superior readability of your Rails code.

Perception: Justified or not, ColdFusion gets a bad rap as dying and/or expensive platform. I've been hesitant to dive head first into the world of ColdFusion since I'm unsure of its future. Ruby, by all accounts, is, has been and will continue to be on its way up in the world. Rails too. With its adoption on the JVM and .NET, its attraction will only grow. Java, in comparison, seems stale and while its probably not going anywhere, it's best days are probably behind it.

Employability: Most Ruby jobs are Rails jobs. Knowledge of other frameworks are usually not required. Although Rails incorporates features from a number of frameworks in the Java world (Hibernate plus Spring MVC, for example), it is still a single framework. You either know Rails or you don't, and it is rare you will receive a Ruby language exam when applying for a Rails job. In contrast, Java jobs often require in depth knowledge of Java (garbage collection, intricacies on serializability, the Liskov Substitution Principle, etc) and knowledge of several Java frameworks (Java EE, Spring, Hibernate, Axis or whatever). This is a lot know, and it forces Java programmers to pick their niches early in their career and makes it hard to break out of it. For example, can you really go from being a Spring middleware guy to write UIs using the Google Web Toolkit? Not easy, to be sure.

ColdFusion has the opposite problem: if you know the language, that is usually sufficient. Sometimes, experience with an [any?] MVC framework is desired. Of course, if you know Rails, for example, then you do know an MVC framework and really shouldn't hesitate to apply.

Sum it All Up

So what does this all mean for you? Well, if you're interested in the web space and you don't mind somewhat limiting yourself there for the time being, Rails is a good place to start. But because you probably don't know Ruby of Rails, there is going to be a steep learning curve.

If you have confidence in ColdFusion and its future, I have certainly enjoyed my team in that space, but you should really force yourself to understand and integrate with the Java world that powers it. That should cushion you, just in case pessimists like me are right. Learning an MVC framework like Model-Glue, or learning to integrate with Flex front-ends would be time well spent too.

If you've just finished university, chances are you already speak Java. This is great, but is really just the beginning of the skills you'll need to work in the Java world. Learning a couple of Java frameworks (Spring and Hibernate go well together) should help you find that first good job.

If you are otherwise an experienced Java guru, look at Rails with JRuby. You might realize you have been writing way too much code that nobody else can read.


1 comments:

Derek Neighbors said...

I use Ruby everyday and I am not convinced that it helps you write less sucky code or that it is more maintainable.

I do however think that it is more enjoyable. As silly as that sounds, it means a lot in the way of productivity.