DDD: Client-side script to enforce invariants

Posted by Mosh on Stack Overflow See other posts from Stack Overflow or by Mosh
Published on 2010-04-07T06:39:25Z Indexed on 2010/04/07 6:43 UTC
Read the original article Hit count: 371

Filed under:
|

Hello,

One thing that I'm confused about in regards to DDD is that our domain is supposed to handle all business logic and enforce invariants. I have noticed some people (me included) handle certain invariants in the presentation layer (i.e. WebForms, Views, etc) with javascript. This is mainly done to improve performance so the server is not hit for every request which may be invalid.

Even though this approach may be beneficial performance-wise, it violates DDD principles. What if the business rules are changed? This way we don't have a rich domain where all the business rules are captured. In case of a change, we should change the domain as well as the presentation layer.

Has anyone come across this situation before?

I'd like to know your thoughts on this.

Cheers,

Mosh

© Stack Overflow or respective owner

Related posts about ddd

Related posts about validation