On Mon, Feb 9, 2009 at 2:50 PM, denstar <[email protected]> wrote:
> So do you guys think that the ActiveRecord debate is part of the "fat
> service" vs. "fat object" debate?

No, not at all.  Fat service (or it's equivalent inverse anemic domain
model) is about putting entity behaviour in your service layer.  The
AR debate is where persistence operations should live.  I.e. does it
make sense to ask a Person to find all people with from a given state,
or should you ask some sort of querying service that question.  In
real life you'd certainly ask a person who their children are
(person.getChildren()).  But you'd never ask a person for all the
subscribers with at least 10K in sales that live in Wisconsin
(person.findByIsSubscriberAndSalesGreaterThan10000AndStateIsWisconsin()
or whatever).  Putting that latter behaviour on your Person class (via
a dynamic finder) really twists your domain model.

The fact that that method is dynamically processed for you is great;
it's a huge benefit of using Grails.  That said, the Person class is
NOT the place it belongs.  With Groovy's neat dynamic programming, you
can easily "move" it to your DAO of choice which is handy, so you can
get back some of the purity without having to reengineer everything.
It's just in the wrong place to begin with.

> Now, you can annotate your domain classes with this info, or use a
> Hibernate mapping file, neh?  The mapping file keeps the ORM specific
> metadata out of your class itself, which is good for encapsulation,
> from one vantage point, but it's bad from encapsulation, from another
> vantage point, as you've got a couple places to change what is
> essentially related information.  Sorta violates the single point of
> reference deal.

I'm a fan of annotations, as thin as possible.  It handles the base
cases quite well, but doesn't preclude the use of XML if some deployer
needs to do it that way.  The Hibernate guys were on their game with
that one.  And since your constraints and such are there in your
domain model (where they should be), it feels reasonable to supply
some additional annotations about the state semantics (this String is
short, this String is long, this date is transient, etc.)

And yeah, modeling is kickass, though the tooling is still lagging.  I
worked on a project that we did full roundtripping a couple years ago
and it was great, as long as you didn't need a scenario that the
tooling couldn't handle.  Then you're stuck.  ;)  But that's
undoubtedly better now.

cheers,
barneyb

-- 
Barney Boisvert
[email protected]
http://www.barneyb.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to