struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Petrelli <antonio.petre...@gmail.com>
Subject Re: Confusing model with controller
Date Tue, 25 May 2010 12:08:49 GMT
2010/5/25 Robert Graf-Waczenski <rgw@lsoft.com>:
> My intuition for the "model" is "that which is serialized to disk" (or, more
> generally: "to persistent storage"). This means that such a class does not
> contain any business logic but only has getters and/or setters.

No, domain objects do not need to be anemic:
http://en.wikipedia.org/wiki/Anemic_Domain_Model
You can put logic in your domain objects.

> In reality
> (and in many nontrivial projects) the distinction is not as strict, so your
> "model" class may very well have methods that go beyond getting/setting
> properties and you may in fact have instances of "model" classes that live
> (at least temporarily) outside the "model" domain.

"business logic" methods are, in fact, part of the model.
Let the services, or DAO, or whatever, do only the
persistence/retrieval part of your code.

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message