DDD with web application - How to avoid rule duplication?

by CodingYoshi   Last Updated September 12, 2018 19:05 PM

Imagine we have a simple rule:

A member must be at least 18 years old to join.

Imagine we have a C# class for Member and it is our domain model. The rule is enforced in this class.

Now we create a web app with a view to create a new member. This view has a datepicker for entering a date for date of birth. It makes no sense to allow the user to select a date which is not valid i.e. last year. To enforce this, we need to write JavaScript. However, now the business rule has been duplicated.

This is a simple example to illustrate the question but in a real application, there will be many such duplications.

Is there any way to avoid this?

Related Questions

Domain Driven Development approach for game

Updated April 29, 2018 09:05 AM

Designing a DOM library

Updated June 01, 2016 08:02 AM

Unique ids for nested resources

Updated July 16, 2017 05:05 AM

Data modelling in quiz application

Updated March 03, 2017 17:05 PM