Friday, December 21, 2007

trying out ruby

Last weekend was a slow weekend. It was really nice for a change. On Friday, Jason (from work) sent me a link to some demos of ruby on rails. He had been talking about ruby off and on for some time now - usually in the capacity of comparing developers.

I didn't want to be the kind of developer who had nothing to offer to a discussion about C# vs Ruby any longer, so I decided to heed his suggestion and spend some time with Ruby. So I spent nearly all weekend with Ruby and what have I got to say? Not much aside from a superficial evaluation.

I spent a lot of time getting the environment squared away. The actual Ruby on Rails install was simple. However I tried to configure it to work with Microsoft SQL Express. This was a bad idea. The reason this is a bad idea is the same reason the RoR motto is "convention over configuration." When you install RoR, you can see clearly that it plays well with MySql. Instead of going with the flow, I decided to travel upstream for several hours. Just like my analogy, I didn't get far. Right. So. Install MySql and things work like a charm.

Once I got the environment settled, it was time to get down to work. RoR installs with a small, super-powered notepad clone with some syntax highlighting. It's pleasant if you're into painful and tedious opening and closing of files. Otherwise I recommend an IDE I discovered, Aptana Studio, where I was able to start making sense of things.

So what amazingly stunning web sites did I produce? I walked through the tutorials I found online and attempted to apply them to the concepts I've been considering for my side project, ScoutOffice. Let's just say I'm not rushing out to become a Ruby developer. I'm still struggling with getting the relationships between various models right.

Despite my troubles and apparent inability to learn a language quickly, Ruby on Rails does have some interesting characteristics:

Drink the Kool-Aid. If you can swallow the quirky and debatable conventions Ruby on Rails prides itself on, it is truly amazing how quickly things can "just work." I was able to develop all CRUD actions within mere minutes provided I used MySql, named my data table as a plural, used an integer as the table primary key identity, and properly cased things. If you don't mind sacrificing a debate in best practices, this could be your language!

Ruby can make the bad web UI guys look really bad, really easily. It has this nifty scaffold feature which (I'm sure no real Ruby developer uses that) creates web forms for you on the fly. However the layout and style leaves a lot to be desired. That's great if you know how to modify those things easily. For those of us who struggle with Microsoft Paint, we're screwed. Ruby has a way of showing how bad one's UI skills a re in an instant.

So I have a pretty superficial opinion of Ruby on Rails at this point. It has a lot of merits, but I'm about to give up my day job. I do think I'll be revisiting it however and I haven't ruled it out as a possible avenue for ScoutOffice to go down.

4 comments:

Unknown said...

The thing I don't like about Ruby (in general) is that there's a lot of punctuation, which I find makes code hard to read... unless you know Ruby. "What's all this @, < and |blah| nonsense?" I can see (non-Ruby programmers) looking at your code trying to figure it out. And there are a lot of Conventions in Ruby too, it seems (but then I fault the Pickaxe book here for not making it explicit if these conventions are required or not).

And I'm pretty well convinced that Ruby is for Programmers who want to get something done, and not a good First Language. Not that that's a bad thing, but yes it feels like drinking lots of KoolAid sometimes.

And there's often three ways of doing even simple things like if statements (!!!!??).

THe language feels very OO to me, which is good... but too OO, which feels like overkill.

But it does avoid a problem Python has with significant whitespace... because Ruby uses "end" to end a section of code, it avoids the "Huh what is the compiler trying to tell me" that you get sometimes compiling Python with messed up line endings.

And blocks are cool. The ability to define what are essentially callback functions _right there_ is _nice_.

Haven't done anything in Rails, but I read the first half of the Pickaxe book and modified some Ruby scripts here and there... not really anything big, but it did get me a taste of the language.

David Campbell said...

I agree with your comment about punctuation. I was fascinated with the "3.years.ago" syntax. I'm still trying to get basic syntactical structures (if, loops) down.

I have mixed feelings about Ruby as a first language. If you can put aside it's odd syntax, it has some compelling reasons to learn it first. As you said, it is highly object oriented. And Rails automatically pushes your designs into the MVC pattern - another good start for new programmers. Third, Ruby on Rails seems like it was designed such that doing the simplest tasks are the most intuitive.

I think I find RoR less intuitive simply because I come from a Java, C++, C# background.

Anonymous said...

radrails.org

You're using the evolution of Kyle, Matt, and Marc's Eclipse-based IDE

David Campbell said...

I thought that was the case.