RE: Validating Object Compoisitions

<[email protected]>
Newsgroups gmane.comp.programming.domain-driven-design
Message-ID <[email protected]>
Hi Michael,

I can't comment on your second question, but regarding your first one, I would add the domain service containing the business rules as an extra parameter in the Account.deposit method. The account can then double dispatch to the domain service.

Does that make sense?

Jan

--- In [email protected], <michael@...> wrote:

Hi

I try to apply DDD to my current private project. Let's assume the domain is something with banks and I have 2 Aggregates - they are responsible for their consistency inside the aggregate. But how about business rules which have to take all 2 Aggregates into account?

E.g. Aggregates are "Person" and "Account" and the business rule says "Persons which are older than 25 and today is Tuesday, not more than -20$ of deposit are allowed".

In my opinion putting this in a service is not a good idea, because due a software fault some caller could bypass the service and could call "Account.Deposit" directly. So doing the business rule validation in "Account.Deposit" makes sense (in my opinion).

If the amount of rules increases, I would put it in a separate "Business Rule" assembly. In the book "Implementing Domain Driven design" I found it on page 215.

My questions:

* The approach there is to use a Domain Service. Is this not dangerous in case of software faults / bypassing?

* Has anybody some good design advices for business rules? I found the "Specification Pattern" - but is there some theory for "Conflicting Rules" or "First match" vs. "All match"?

Thanks

BR

Michael

__._,_.___

Your email settings: Individual Email|Traditional

Change settings via the Web (Yahoo! ID required)

Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured

Visit Your Group |
Yahoo! Groups Terms of Use |
Unsubscribe

__,_._,___
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.