I am curious on what you guys think about DataMapper and what benefits does it bring over the new and improved ActiveRecord in Rails 3.
I appreciate your opinions.
I prefer DM to AR. I feel DM is actually an ORM whereas AR is just a wrapper around SQL. DM makes is very easy to switch between data stores. Query syntax of DM is much more homogeneous etc. SEL (strategic eager load) also makes DM look more like an object store than AR.
Moreover, DM classes define properties up front and it makes the code much more readable. I have never missed migrations after coming to DM world. (even though you may have them if you really wish). With rails 3, I am almost exclusively using DM.
I used Active Record in Rails 2 and DataMapper in Merb and Rails 3—I now use DM/Rails 3 daily. I've read up on AR3 but only used it in one small project (an in-house app.)
I've found the only difference I really care about is DM's strategic eager loading. It rarely does what one would hope and what it does, right and wrong, it does with FM.
With explicit eager loading in AR, there's no question what should be occurring: it says what it does and (usually) does what it says.
While "automatic" eager loading sounds good, I find it has two negative results for me:
Otherwise, I find AR and DM to be the same beasts with different spots. Unlike say, Sequel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With