From: "s.ross" Date: 2008-02-03T09:49:44+09:00 Subject: Re: Comparing Active Record VS Datamapper...? On 2/2/08 3:56 PM, "Ilan Berci" wrote: > Softmind Technology wrote: >> Hello, >> >> Comparing Active Record VS DataMapper...? >> >> Can any one provide more details on this.. >> >> Any Links of Blogs comparing the above two. >> >> I shall also welcome your suggestions on this. >> >> Thanks > > I was curious about this myself, I have used AR for years now and I was > interested in DM's promise of no migrations and optional lazy loading of > fields. I have no problem expressing my fields in the models (I > actually like it) and I have no problem being committed to MySQL. If DM > can update your schema automagically when seeing an > incompatibility/update with your model then I won't sleep for a week due > to the magic of it all. > > I used to think that migrations were the best thing since sliced bread > but due to the fact that AR attempts to cater to every major vendor, I > usually have to go in a hand tune my migrations anyways (bigint and > foreign key constraints which I realize many feel are unnecessary when > working with RoR). I also used to follow OG as well but after some > playing around, i came to the conclusion that updating the schema with > it was far more difficult than it was with AR. > > Merb right now is a big carrot for me and it has direct support (through > gem dloads) for haml AND DataMapper so I think something truly great (or > at least very exciting) is in the mix! Due to the fact that I am a > coward however, I still use AR at work as I am very comfortable with it > and I finally got used to a lot of it's black magic through > method_missing craziness. > > Merb/DataMapper is a cinch to dload and set up so you should see it for > yourself.. > ilan > > I'm no DM expert, but from my perspective the benefits are: - Really modular: Add-ons installed as gems (AR is kind of moving this way) - Thread safe. 'Nuff said. - Works in Rails, Merb, and stand-alone Ruby programs Now the magic migrations (ala Og) have been a subject of some debate because They toast the table when they happen. As I understand it, adding a country field to an address table would drop the table and recreate it. This can be a particularly annoying side effect when dealing with tables that have related tables, or worse, habtm. There are claims that DM is faster than AR, but I have yet to demonstrate that on any of my sample data. They seem pretty much on a par. Download it and stick it in one of your play apps to see what happens.