~TLDR: I\'m implementing a CQRS + DDD solution for one of my larger projects, and, I\'m wondering if there is any real reason that my command handlers can\'t directly dispatch t
Command objects are usually expressed in primitive types while aggregate method signatures will be expressed in domain concepts.
The fact that you didn't immediately recognized that probably means that you missed a lot of opportunities to make implicit concepts explicit in your domain.
"a registration command that takes in 8+ fields (firstname, lastname, preferred name, dob, title, username, password, department etc)"
What should strike you is that firstname
and lastname
could definitely form a meaningful whole, such as new FullName(firstname, lastname)
and I'm sure there's a lot of other cases where Value Objects (VO) could or should be used in your domain... Username
, Password
, etc. ? Using VOs to model things that changes together will better describe your model as well as reduce the number of arguments you have to pass around.
Therefore, that makes command objects poor candidates as aggregate method arguments. If you go down that road, you will definitely miss modeling opportunities.