Posted by Daniel Wed, 16 May 2007 20:34:43 GMT

A long time ago I started writing code because I needed solutions for *my* problems. Not thirty other problems which made it difficult for me to get stuff done. I like getting stuff done.

Ruby continues to attract me after nearly 4 years. I’m amused at how little Ruby I’ve actually written. It’s the nature of the problems I solve with it, in combination with the incredible power of it’s terseness and well written libraries.

For example, a client has data in a MySQL database. The app that put it there seems to have gone missing in a move, and until recently the data was not required. As these things go, it went from “huh?” to “sound the alarms” in short order. My solution to their emergency? Roughly equivelant to:

require 'rubygems'
require 'active_record'


ActiveRecord::Base.establish_connection(
        :adapter => 'mysql',
            :host => '127.0.0.1',
            :database => 'something')

class User <ActiveRecord::Base; end

User.find(:all).each do |f|
  puts "#{f.name}'s email address is #{f.email}"
end

Sure, someone wrote a lot of smart stuff that I relied on… but isn’t that always the case? Well, it is for me. But that’s very little code to set up an ORM and return a useful object.

I recently worked with a C# implementation of the Active Record pattern and was amazed at how much more code (and config) there was involved in getting the same result. That’s not a knock on C# or even the implementation, but it seems that it is in the nature of Rubyists (and Ruby) to produce such minimalist design. I enjoy that.