I'm applying Clean Architecture + DDD (maybe) in my project (web Application + REST API).
The good thing I learned from the Clean Architecture is using "Interactors" to show business use cases in my code, which is naturally fit with Command pattern. So that I use Command Patterns in my project.
Normally, I named my command as "AddNewRequestCommand".
But I'm thinking about change it to "AgentAddNewRequestCommand", which naturally fit my user story and the command itself show the full context of the command because every use-case need an actor.
Say I have this User Stories:
- As an agent I want to add new delivery request, so that I can deliver my goods.
- As an agent I want to list my created request, so that I can manage my created requests.
- As an administrator I want to list all request in the system, so that I can do the customer support easier
(Agent,Administrator..are business actors, It's not about roles/permissions)
- Commands/Queries will show all user story of application
- Command/Query show actor & context of the use case. So that I can get a bigger picture of the use case. I don’t have to ask a question like: “Who will execute this command”
- Convert User stories to Command/Query easily. So that, developer & BA/PM can say the same language.
- It will cause some confusing between Actors and Roles: How about I’m an administrator & I want to add new request.
What do you think?