cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <...@maniatis.org>
Subject Re: Add ActiveRecord support to Cayenne
Date Wed, 26 Dec 2012 17:04:17 GMT
On 26/12/12 11:40am, Andrus Adamchik wrote:
> Ilya's point that we discussed a bit offline was that AR-like design is more object-oriented,
with object providing all operations on themselves. The context will be taken from the current
thread (something we already provide). One piece of theory behind it is a reference to the
Fowler's criticism of "anemic domain model":http://en.wikipedia.org/wiki/Anemic_domain_model
 .

I find this quite interesting. One problem we are trying to solve on our project right now
is bringing together logic between the client and server entities in a ROP system. Because
Cayenne entities inherit from different superclasses (what's with that?), it is very hard
to keep the business logic in a one place.

Anemic models are all very well, but what do you do with the code? It seems that all the options
available to us aren't terribly convenient to use. We either end up with zillions of interfaces
or lots of static methods.

AR is the opposite of anemic. All the Rails projects I've seen tend to throw lots of code
into the model. But because Ruby uses duck-typing instead of interfaces, things don't get
quite so messy. Even searching is rooted in the model classes:

    Artist.find(:name, "bob").sort(:age)

or something like that.

Ari

-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Mime
View raw message