I would caution against pulling validation out of the domain model
entirely, since it could lead to Fowler's Anemic Domain Model
antipattern:
http://www.martinfowler.com/bliki/AnemicDomainModel.html
It's also worth emphasizing that putting behavior into the domain
objects should not contradict
Hi Cliff,
This is still something I'm trying to come to terms with. I've seen the
references to the anaemic domain model and am trying to understand how to
best go about arranging models.
Lets say you want to process a user registration form. Your controller
packages up the input scope (form and
I think that the discussions that Martin Fowler has raised in his
post about the 'AnemicDomainModel' are definitely quite interesting,
and by all means worth investigation, but I really think it should be
taken with a healthy grain of salt. If you find yourself struggling
to figure out how
Hi Chris,
The service model is intuitively more attractive to me and it is how I'm
currently doing things. I also see how a coder like myself with limited OO
experience would prefer this approach even if it wasn't better, so I'm
trying to get the underlying arguments from both sides.
I
Title: Message
I'm going round in
circles on this.
One the one hand it
seems attractive to put transformation, validation and calculation code into
beans. Now they are (at least somewhat) smart.
-
MyUser.setPhoneNumber() can now regex to remove non-integers and can return
whether the
Cliff,
Thanks for the suggested readings. It did help and has me thinking back to
some earlier OO objects I used for client server apps I wrote several years
ago. (BTW that did give me another approach idea so thanks for jogging my
memory) I believe Fowler would say those objects were more full
Lots of good discussion here.
The big question is where your business logic goes. ADM is an
approach where the data contructs (beans/domain model) are operated
upon by methods in your service layer. Here the domain objects are
often called dumb data holders that don't really have any behavior
I'm currently thinking through a model and the more i do this, the more
i see there are SO many options. It's just overwhelming. I love the
flexibility and power that OO brings to an application. Luckily, it
seems to manage to do that on it's own, even if i manage to bungle up
the design of
That's why you have to budget at least a little time for the
all-important refactoring: because we all screw it up the first time
around... or sometimes more than that! :)
On 6/14/06, Nando [EMAIL PROTECTED] wrote:
I'm currently thinking through a model and the more i do this, the more i