Open
Description
Currently, there are two ways to map(describe) fields in DDD elements - via methods and objects:
Entity
: require to map fields as a methodValueObject
: require to map fields as a method or objectAggregate/Process
: require objectsCommand
,Event
- both store fields as objectsCommand Handlers
,Event Handlers
- methods (on aggregate, processor)API endpoints
- methods
We should have standardized way to map fields, so there is no confusion what type of mapping we need to use on each DDD element and how to access them everywhere(this is very important). Another option is to allow both mappings (by doing in every place where its needed - a check for fn/object and acting accordingly) however by doing so - this can be confusing on long run.
By allowing objects were supporting extensibility, but the cost of confusion that you can extend anything from anywhere easily like that can let to bad design choices in developers code.