5 Reasons DataMapper Will Deprecate ActiveRecord 5
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.
Engine Yard As A Service
Ezra just announced a new service coming in January. They’re extracting the Engine Yard stack into an easily configurable service for booting up new Engine Yard nodes. The service is promising, even supports building nodes based on JSON. I’d expect this type of setup to replace AWS as a rails stack based on all the work Engine Yard has done on the deployment process and operations of a rails stack. The screens shown looked highly configurable, check boxes with memcached, mysql, erlang, etc. also add users, ip addresses, etc. Just about everything you would need to build a complete rails stack, with no hands.
After talking to Ezra and Vivek Engine Yard As a Service is not necessarily a web service they provide but more of a stack as a service they provide. Say you’re locked into a contract with a hosting company or you love your hosting company but they don’t know anything about building a rails stack or you’re cheap and you want cheap VPS’s, you run EYAS on your choice platform. I asked a few questions about how Engine Yard intends to go about doing this, though partnership or through an install process for the end user and it sounded like some of those things are either secret or not defined yet. Even with the specifics still a bit unclear the prospect is very exciting.
#prorubyconf08
I’m at the Voices That Matter conf in Boston. Met some old friends, met some new people. Some talks are interesting as my team is mostly operating in a vacuum rails-wise. Most of the team has experience working at larger companies but not in rails at a larger company. So it’s nice to hear what other larger companies are doing and how their rails team fits in to the business. The yellowpages.com talk was interesting to hear that most of their hits are static and not using ActiveRecord at all. I’m thinking that FanNation with it’s large amount of dynamic requests is got to be one of the larger rails installations. Also surprised to hear that NYT uses a handful of EC2 instances to do mostly page cached/generated pages. Again not much (if any) dynamic content generation.
At the end of the conference I won a prize (I think for talking a lot of shit on the irc back channel). I picked Obie’s book The Rails Way. The book is hugegantic weighing in at around 800 pages. So far I’ve skimmed the book and it looks promising. Lots of code examples, etc. I’ll do a full review once I get to read it.

