Showing posts with label ruby. Show all posts
Showing posts with label ruby. Show all posts

Sunday, June 24, 2007

OR - ActiveRecord

Via Bill de hOra I saw this: this on ActiveRecord at Twitter.

Couple 2-3 quotes:

One major downside of having an object-relational mapper is that you don't always control what goes on behind the scenes.

This pretty quickly brought us to an obscure corner of the ActiveRecord source (three cheers for source code!), where it became apparent that Rails was doing these gigantic loads from the database every time we saved even a single field in a related object. There are a bunch of mitigating circumstances that mean that this bug doesn't get triggered all the time, but it's still really really bad.

You mean insane SQL isn't just a problem with Java based OR tools?

I think Ruby is great. I think that ActiveRecord is great and do think that it has it's place.

My problem is that every time I have been associated with an OR tool (Toplink, EJB CMP, Hibernate) the exact panic described above has ensued. In my experience OR tools have been like very bad debt. They are shiny objects that make initial development a bit simpler & then make you pay pay pay down the road.

Now I don't have much information on Twitter, but I'd think that it would be the type of system that you would want to write SQL by hand for. You can either get some syntactic simplicity from OR tools and defer how the SQL gets generated (and wait for panic to ensue) to an OR tool or you can write SQL (a really simple language) and be in control.

Control isn't always required - and I am a big fan of Ruby on Rails - just sayn' choose wisely - there is more to life than concise model to database interaction.

As for the Three cheers for source code line, +1MM. Never ever use an OR tool that is not OSS. That is just asking for it.

I am going to get a breakfast burrito now.

Sunday, July 30, 2006

Ruby Blocks

I commented on how I think Ruby Blocks are pretty sweet to my friend Erik and he responded:

come on dude, you sure you wouldn't rather type:

File f = null;

try
{
    f = File.open("/tmp/bs");
    //do-stuff
}
catch(IOException ioe)
{
    //die!
}
finally
{
    if(null != f)
    {
        try
        {
            f.close();
        }
        catch(Exception e)
        {
            //eat-it
        }
    }
}

than:

File.open("/tmp/bs") { |file| //do stuff }

(that's my favorite example btw)

Yeah, so I like blocks better then the above ;)

Saturday, July 29, 2006

Learning Ruby

I am embarrassed to say that I don't know Ruby. I've hacked together shell scripts, done some Perl, but don't yet have any experience yet with Ruby.

Looks like my team may be using a bit of it, so I'm going to start learning it.

Just returned from Powells Technical Books (best bookstore flat out) with a Ruby book. They were all out of them at OSCON, but still happily gave me the OSCON 35% discount. I didn't have my badge from OSCON on me, but I did have a Mozilla Firefox T-shirt on so they believed that I'm a hacker.

Upon the recommendation of my friend Erik, I bought Dave Thomas' Programming Ruby.

I'll let you know what I think as I learn. I know a lot of people who I respect who dig Ruby. I'm assuming I will as well. I doubt I will turn into a Java basher though (like a lot of the Ruby on Rails crowd), but one never knows.