On Fri, 08 Jun 2012 12:47:43 -0300, Lance Java <lance.j...@googlemail.com>
wrote:
This conversation sounds like the "Anemic Domain Model vs. Rich Domain
Model" argument where an ADM only contains data and a RDM contains data
and
services.
Hey, I don't use ADM! I explicitly said it sucks! ;)
I have always used an ADM and like Thiago, I sometimes add
functions that do not require a database connection.
I always add methods that don't require external dependencies (DAOs,
controller classes, etc). :) I'd say I use a medium class domain model
(not anemic nor rich, something in between).
I have never really
understood how to inject the session into an RDM without using a factory
pattern. I once read that someone was able to intercept the constructor
for domain objects and inject the session so that a factory pattern was
not
required but I can't seem to find the link for that. It sounded a bit too
magic to me and when it comes to code, I hate magic ;)
Using Tapestry, you could create a factory service that uses
ObjectLocator.autobuild() for instantiation and dependency injection
(supposing there's a constructor that receives the DAOs needed in the
entity classes.).
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org