After listening to this weeks Ruby on Rails podcast where Geoffrey Grosenbach interviewed Bruce Tate, it got me to thinking about why Ruby on Rails appeals to me. For me as a Java person, the real appeal of Ruby lies in Rails and here’s why:
- Rails is a one stop shop with a web MVC framework that has AJAX support, an OR Mapping framework, logging framework, default directory structure, unit testing, functional testing, etc… Bottom line is that it’s much easier for someone to get productive quickly in RoR learning good practices such as TDD than in any equivalent Java setup. Heck, at work we still don’t have a good functional web testing framework for the programmers to use because after some tinkering I still couldn’t get it to start Tomcat, deploy, and run the HttpUnit tests reliably. The first time I tried Rails, the logging, mvc framework, OR Mapping, web services integration, functional tests, unit tests, etc… just worked, wow!
- Rails let’s you learn things when you’re ready to whereas in Java, just to get my projects off the ground, I have to understand the build system, Hibernate configuration files, web.xml, log4j configuration, my MVC configuration, etc… I still don’t know the first thing about Rake (the build system) even though I’ve built a couple small web projects in RoR and you know what, that’s a real testament to how well it does it’s job. I’m focusing on solving my business problem now, not on learning a build system! Similarly there are massive black holes in my knowledge around ActiveController, ActiveRecord, Rails’ AJAX support, etc… but it hasn’t stopped me from using those features and being productive! I hope to learn the ins and outs of these components eventually but that’s in direct contrast to Java where you have to front-load tons of knowledge to be productive!
- Rails recognizes that in the real world there are differences between your dev, test, and production environment whereas I’ve always had to roll my own solution in Java whether it’s through JNDI or the creative use of property files. The key here is that in Rails you have all of those settings in your project under source control making it easy to lookup how a setting differs between test and production, with JNDI that information is stored on the server but it’s irrelevant because everyone does it differently anyhow.
- The Rails community recognized the need for a production deployment solution and came out with Capistrana (ex SwitchTower) whereas in Java with Tomcat we had to write our own from scratch that goes to our 10 application servers, takes each one out of production, deploys the WAR, performs a test, and then brings it back into production before moving onto the next server.
- Jumping in on an existing Rails project should be easy because there are strong conventions whereas in Java every project does almost everything a little differently. You have to learn the Ant targets, the project source layout, how dependencies are managed, how they deploy into Tomcat, and so on. Maven certainly helps address this issue in the Java space but it’s adoption rate is low compared to Ant.
That said, there are still things I really like about Java. For starters I’m an Emacs to IDE convert and nothing compares to the refactoring and code analysis capabilities of JetBrains Idea. Since Ruby is dynamically typed, no IDE will ever support the degree of refactoring we enjoy in Java. Also, once you have your Java environment setup and everything integrated and working, developing new web pages is fast. For example when I develop in Idea I can change a class or a web page and hit refresh in my browser just like I do in Ruby. Since we use JSPX and TAGX files, IDEA tells me if my XHTML is not well-formed XML… I could go on and on.
Suffice it to say that I still like Java but I’m loving that there’s some fierce competition on the block and I hope someday to have the opportunity to develop a large software project in Rails. If you still have your doubts about Ruby on Rails, read Agile Web Development with Rails, it’s a great book that will knock your socks off!
Related reading: Keith Pitty looks at Java versus Ruby on Rails