Main menu

Post navigation

Ruby on Rails – WOW

Over the last couple of weeks I decided to re-familiarize myself with the Ruby programming language. I was first introduced to it back in 2002-2003 at OOPSLA (or was it the Software Development Conference?) when I took a full day workshop with the Pragmatic Programmers, Dave Thomas and Andy Hunt.

Back then I loved the language, but decided not to focus on it since the support in the form of libraries just weren’t there like they were for Python at the time. I wrote a few programs in Ruby, but left it to the side and focused on Python.

Well, those days are over. When I started with Ruby, I decided to take a look at Ruby on Rails as well. Over the last couple of weeks all of my spare time has been focused on learning the Ruby language and this completely awesome framework, even at the expense of regular podcasts.

First off, I’m absolutely enamoured by the language. So much so that with Rails piled onto it I couldn’t imagine programming in any other language. For quite a while I’ve hated Java and the complexity that it brings to projects. There’s just too much work involved in doing Java development anymore.

Ruby combines complete object orientation with the flexibility of a scripting language. Some of the features it has baked into it, such as iterators and blocks make life so much easier.

Now pile Rails on top of it. Rails is an elegant MVC framework written in the Ruby Language by the folks over at 37 signals. These two things combined make for the perfect programming environment for web applications.

But the cool thing is, even with my unfamiliarity with the language I’m still productive. If that isn’t the sign of a great development environment, I don’t know what is.

I’m working diligently to become proficient in the language. Rails is a little complex and I’m still struggling to learn all of the conventions. However, I think most of my programming moving forward will be with these tools. Its just a lot easier to spend time thinking about the problems you are trying to solve and being able to express them eloquently rather than struggling with the complexity and code/compile/run process baked into Java development.

8 thoughts on “Ruby on Rails – WOW”

You’ve always been a scripting junky!!! Yes, Java is more complex and makes you work a bit more, but is C/C++ any different? You mastered those languages without all the bashing you’ve been doing w/Java. 🙂

I’m at about exactly the same point right now, having picked Ruby as my new language to learn this year. I’m amazed how much of a demo application could be built with just a few hundred lines total of Ruby for the sample app in Agile Web Development with Rails. And actually being able to build it TDD without firing up a browser and actually stepping through it was truly liberating.

Seriously, when WAS the last time I wrote anything in C/C++, 5 years ago? Most of my work is in scripting languages these days! With Java, all of the containers and configuration you do just doesn’t do it for me anymore. Give me a good scripting language any day and I’d walk away from C/C++ for a job. Nothing I write these days has to “run like a scalded dog” anymore and languages like Ruby are “good enough” performance wise to get the job done. Hell, even SAP is looking at Ruby.

More than anything, you can actually have fun with scripting languages. Java’s too much like a job. Our son come home on Friday talking about how in “geek club” they were learning about C++. My first inclination (which I held back on) was to say “what are you learning that for when Python, PHP, and Ruby are out there?”.

The way that I have used Java has completely changed within the past two years. Instead of focusing on Java the language I have been using Java more and more as a platform. The JVM serves as an excellent platform for other languages and custom runtimes.

What do I mean? Well, I can use the JVM as a host. The JVM gives me a well defined target for management as well as a large selection of APIs. On top of that I can define a number of different runtimes and host my applications there. Basically, I can create domain runtimes.

The runtime may contain a java class conforming to a rigorous interface. The runtime may contain a rules engine such as jess with the entire application living within jess. Or, the runtime can consists of scripts written in python, ruby, scheme, etc…

The magic is in the runtime and how it communicates with the outside world. Once you have that, you can write your applications without touching another line of java sans for a call to a java api that you make available through your runtime.

I heard about Ruby on Rails from co-workers for the past 18 months. I finally decided to take a look. My analysis is that if you play in the Rails sandbox, life is good. As soon as you need to break out and do something to distinguish your application from everyone else’s, you find yourself making compromise after compromise to keep from deRailing.

I wish RoR the best of luck though… I’m trying to start a new side project using Java/Spring/Hibernate and I’m shocked to find that getting started with these technologies is _more difficult_ than it was doing J2EE programming 5 years ago. wtf?! This is progress?

I tried using Spring a while back and found it too rigid. I liked the design philosophies behind IOC, wiring as config, etc… I didn’t like the mess of XML configuration and I found it very difficult to wire objects together using it. So, instead, I host configuration scripts in my runtime. I have my classes and I use scripts to compose them into something useful. Code is code and XML should never be code. Even the ant folks have said that if they had to do it over they would use scripting instead of XML.

One of my systems uses Hibernate now and I really wish that it didn’t. It seems like a heavy handed answer to a question that no one asked.

I don’t do a lot of web development so I’m not sure what the answer is but I’m pretty sure it is not Java. Back end, sure… an http interface into a system, sure, front end, no way.

From what I’ve heard about both Spring and Hibernate, they require a lot of XML configuration. One of the attractive things about Rails (once you get used to it) is the conventions that are assumed around the application. Once you understand those, it kind of forces you to refactor things into the right place. I have never found that in any Java frameworks that I have looked at.

I agree with Tony’s scripting ideology. I think that front-ends need that flexibility and JSP just doesn’t cut it. I don’t want to spend a lot of time on configuration. I just want things to work.

Using a script as the assembly configuration makes things just work. Back in the day and the entire no one listens meme, I tried to institute such things but was reminded that you never want to mix code and configuration… It was much better to use XML and to treat it as a scripting language 🙂 (though a rich meta model and code generation is even better)

“One of the attractive things about Rails (once you get used to it) is the conventions that are assumed around the application.” What I like about Rails is that it showcases the poswer of domain languages and domain environments. When you build up a language and a runtime to your problem you can express the programs that you write ontop of it in a much more concise way.

Of course, doing so limits you to the expressibility in the domain language that you have created. So you can get into the case where you are limited by your assumptions. You will see “My analysis is that if you play in the Rails sandbox, life is good. As soon as you need to break out and do something to distinguish your application from everyone else’s, you find yourself making compromise after compromise to keep from deRailing.” Nothing is perfect.