If it's for a greenfield project with no existing database(s), I'd suggest
using ActiveRecord for the reasons that Chris mentioned.  However, I still
think that DataMapper shines when you have an existing (legacy) database
schema that you can't change that you want to write models for.

ActiveRecord assumes that it controls the schema, so it wants to put an
auto-incrementing PK on every table, use its own naming conventions for
tables and fields, and needs migrations to keep track of model attributes
(the attributes aren't defined in the model).  DataMapper on the other hand
works well with legacy schemas - you can tell it to use composite primary
keys, use custom table and field naming conventions, and you never have to
run migrations.  It's true that you can coerce ActiveRecord into some of
these things, but you are essentially hacking/fooling it do to so (perhaps
this has gotten better in recent times, like now that it uses
ARel<https://github.com/rails/arel>,
but a few years ago it was a huge PITA).  I don't have any experience with
Sequel so can't comment on it.


On Fri, Apr 5, 2013 at 8:50 AM, Chris Corbyn <ch...@w3style.co.uk> wrote:

> You're welcome.
>
> Initially we adopted DM since we needed to fit Rails around our legacy
> database schema and didn't want to take the hit of having to migrate large
> parts of our schema (which is accessed by a PHP app and a Rails app, both
> of which are large). DM helped us greatly in that regard, since it lets you
> map table names and column names cleanly. We're losing that benefit by
> leaving DM, but we're just going to get our schema more in line with how AR
> wants it, over a period of time.
>
> We could have gone with Sequel instead, but DM's DSL looked more appealing
> to us. I still think that now. The reason we've decided to move towards AR
> and not Sequel at this point is really just about compatibility and
> long-term support. As a business needing to keep our product up to date, we
> don't want to find ourselves backed into the same corner we got backed into
> by choosing to use DataMapper, and using ActiveRecord just means we're
> ensuring we're using a project that is actually going to be maintained for
> as long as Rails is maintained. In short, it's just more practical.
>
>
> Il giorno 06/apr/2013, alle ore 00:31, "Harrison, David" <
> david_harri...@brown.edu> ha scritto:
>
> Thanks very much for the detailed response.  This is very helpful.
>
> Did you consider other Ruby ORMs, like Sequel, rather than ActiveRecord?
> http://sequel.rubyforge.org/
> If so, I'd appreciate your thoughts on why you chose to go with
> ActiveRecord instead.
>
> Best,
> David
>
>
> On Fri, Apr 5, 2013 at 7:26 AM, Chris Corbyn <ch...@w3style.co.uk> wrote:
>
>> Here's my $0.02. We're currently in the middle of the huge refactor to
>> remove DM1 from our app and switch over to ActiveRecord. We've been using
>> DM1 for about 18 months at this point.
>>
>>     - DM1 is not being actively developed. Discussion with the core
>> contributors on Twitter came to the conclusion that support for it has
>> ceased and there are no plans to maintain the code any further (
>> https://twitter.com/dkubb/status/304315005619273728)
>>     - Even Pull Requests are not being actioned at this point (
>> https://github.com/datamapper/dm-core/pulls)
>>     - DM2 is quite different to DM1, and the release date is still
>> unknown. Either way, moving from DM1 to DM2 is going to be painful in a
>> large app.
>>     - Because DM1 is not maintained, issues are beginning to crop up with
>> common dependencies (e.g. multi_json, addressable) that hold back the
>> entire project (https://github.com/datamapper/dm-core/issues/216).
>>     - You'll run into issues with many Rails gems assuming you're using
>> ActiveRecord. This hasn't been a huge issue for us, as many gem authors
>> have begun to support other ORMs, but it does throw some hurdles in front
>> of you.
>>     - Some things that "should" work in DM1 don't work, and don't work in
>> fairly serious ways e.g.
>>       * (Model.all( … ) | Model.all( … )).all( … ).destroy (incorrectly
>> deletes all records from the table)
>>       * Models can fail to save due to validation errors on related
>> models, which are *extremely* difficult to track down.
>>     - Currently DM1 isn't compatible with Ruby 2.0… in light of the
>> ceased development, this is a problem for us.
>>
>> I think if you're starting a new Rails project, you would do well to just
>> use ActiveRecord and avoid a world of pain trying to use DM1 as it
>> currently stands ;)
>>
>>
>> Il giorno 05/apr/2013, alle ore 21:58, david_harri...@brown.edu ha
>> scritto:
>>
>> Hello,
>>
>> I'm considering using datamapper 1.2 on a project.
>>
>> However, I'm curious what are the "various integration issues" that might
>> be encountered when using DM 1.2? (See reference below, from December).
>> Have those issues been resolved?
>>
>> On Saturday, December 1, 2012 8:30:28 AM UTC-5, solnic wrote:
>>>
>>>
>>> It's also probably worth to mention that DM1's development is no longer
>>> very active. We're busy working on the next major version of DM which
>>> implements Data Mapper pattern and that's probably something you're looking
>>> for unfortunately it's not finished yet.
>>>
>>> DM1, given its stale development, is not really a good choice IMHO.
>>> ActiveRecord has much better support in Rails and you can face various
>>> integration issues when using DM1 (no matter how much I hate to admit that
>>> heh). It is also a big unknown when and even IF we're going to release DM
>>> 1.3.0.
>>>
>>> # solnic
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "DataMapper" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to datamapper+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to datamapper@googlegroups.com.
>> Visit this group at http://groups.google.com/group/datamapper?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "DataMapper" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/datamapper/UCHC5TF6I0M/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> datamapper+unsubscr...@googlegroups.com.
>> To post to this group, send email to datamapper@googlegroups.com.
>> Visit this group at http://groups.google.com/group/datamapper?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> David Harrison
> Lead Developer Analyst
> Computing & Information Services
> Brown University
> 401-863-7455
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "DataMapper" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to datamapper+unsubscr...@googlegroups.com.
> To post to this group, send email to datamapper@googlegroups.com.
> Visit this group at http://groups.google.com/group/datamapper?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "DataMapper" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to datamapper+unsubscr...@googlegroups.com.
> To post to this group, send email to datamapper@googlegroups.com.
> Visit this group at http://groups.google.com/group/datamapper?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to datamapper+unsubscr...@googlegroups.com.
To post to this group, send email to datamapper@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to