5 Reasons DataMapper Will Deprecate ActiveRecord 5

Posted by acts_as_flinn Fri, 02 Jan 2009 05:24:00 GMT

Merb brought much attention to the ActiveRecord alternative ORM DataMapper and I feel like it’s going to put a serious hurting on ActiveRecord. My reasoning is based on the fact that alternate data storage technologies are gaining serious traction. The latest and greatest (couchdb, dynomite, cassandra, thrudb) are offering distributed document / object databases that will make creating highly scalable websites even easier and faster, oh yeah and they’re all free. With that in mind, I’m expecting a paradigm shift in data stores (big variable huh?). At the very least I expect Maglev to come true and the free/open source clones to follow. The model storage shift then becomes, how to you write the validations, callbacks, plugins and relationships for first class Ruby objects… DataMapper basically has all the pieces there already. With that in mind here are 5 reasons DataMapper will rule Ruby object data storage.

#1 Rails 3

(this is the big one) Rails 3 (Merb) will open Rails up to ORM alternatives like DataMapper. This will fuel uptake of DataMapper and others.

#2 property

This is a core difference in how DataMapper and ActiveRecord work. DataMapper allows the developer to define the property (attribute/column) in the class. Defining your attributes is better than letting the data store define it. This will become more apparent with the adoption of document/object databases that don’t define a hard schema.

#3 It’s Ruby

Defining properties in terms of real Ruby classes is the hotness. Take any ruby class then, include DataMapper::Resource… done.

#4 Laziness + Strategic Eager Loading

Yeah, one of DataMapper’s core features is it’s ability to iterate over associations without causing the n + 1 query problem. Whether dealing with SQL or Memcache or something new this will always be an issue. It’s 1 vs. many selects, io, or network hits it will never not be an issue. DataMapper handles this gracefully.

#5 Mapping Data vs. Record Handling

ActiveRecord is based on the assumption your storage is a database record. The entire library is written with that in mind. DataMapper is extensible and modular. Don’t need SQL? OK great, but you still need validations, properties, callbacks, and relationships. DataMapper has this covered whether it’s SQL, REST, CouchDB, or anything else. It’s easy to create something new.

Trackbacks

Use the following link to trackback from your own site:
http://www.actsasflinn.com/trackbacks?article_id=5-reasons-datamapper-will-deprecate-activerecord&day=02&month=01&year=2009

  1. 5 Reasons DataMapper Will Deprecate ActiveRecord is a well pointed out list of reasons why DataMapper will in the author’s opinion overtake ActiveRecord. And there is nothing left to do but to agree. I started a project a while ago, 1topf.n...
  2. 5 Reasons DataMapper Will Deprecate ActiveRecord is a well pointed out list of reasons why DataMapper will in the author’s opinion overtake ActiveRecord. And there is nothing left to do but to agree. I started a project a while ago, 1topf.n...
  3. 5 Reasons DataMapper Will Deprecate ActiveRecord is a well pointed out list of reasons why DataMapper will in the author’s opinion overtake ActiveRecord. And there is nothing left to do but to agree. I started a project a while ago, 1topf.n...
  4. An average application in the clouds Alice, Bob and Mallory
    A couple of days ago I published my first applicaiton "in the cloud". I named it Average and it's only a tiny little app that I did for fun and learning. It's written in Ruby with the micro framework Sinatra, DataMapper, Haml and published to Hero...
Comments

Leave a comment

  1. Avatar
    Justin about 16 hours later:
    Great article!!! You forgot one HUGE advantage over AR... ALL class methods in DataMapper are scoped to collections. IE. in ActiveRecord you need to use either the "named_scope" method, or the half assed "scoped" finder method. Named scopes are terrible to organize in AR, but the benefits are huge when trying to model your data domain. Either AR embraces all class methods scoped to collection, or it parishes into non-existance. Also, checkout the development gem for DataMapper utilizing Tokyo Cabinet... thats even more of the future, right tharrr. ;)
  2. Avatar
    ActsAsFlinn 1 day later:
    Yes, I've been looking into the whole Tokyo stack Cabinet+Tyrant+Dystopia. Very interesting to me. What I really want is Maglev.
  3. Avatar
    Dan Kubb 1 day later:
    Flinn, thanks for your kind words about DM :) To be fair, there's still a few RDBMS centric ideas in DataMapper that we are working hard to generalize -- Relationships come to mind there. I think this year we'll see some neat combinations of Tokyo Cabinet + dm-is-searchable + full text indexers like Ferret and Sphinx. Using that combination you'd have the same searching ability as any of the RDBMS adapters, as well as lightening fast lookup and storage.
  4. Avatar
    moritz 6 days later:
    either typo's trackback is broken or wordpress sucks.. good post, anyway.
  5. Avatar
    ActsAsFlinn 6 days later:
    @moritz yeah typo sucks lately. thanks for the link!
Comments