DFlow has two different types of business object:
Both are responsible for:
- Enforce the existing rules for the concept that they represent, like:
Money internally is a numeric type, and has rules like least value is 0, and maybe a top limit value.
So, for those do we use:
- read-only object rule enforced by private constructors and supported by factory methods
- Existential validations rely on Validator object implement with FluentValidator
- Transport validation error to parent object like Entity via property ValidationResults
We really would like to remove FluentValidator dependency and to have our own implementation of Chain of Responsibility desing pattern but we can't lose factory method object building style.
One thing that could be nice is to concepts like ValueOf library and implement validation integrated to Object construction.