-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change CRUD operation commands to add/edit a Product in the Admin Panel #49
Comments
Per Daniel:
|
I'm not sure how pragmatic it would be to have a separate Command for each data point in the application. I do like the idea of knowing exactly what values change on the product. This would work very nice with Event Sourcing. This is also a great way to express the various ways in which you can manipulate the domain Entities. The drawback is you basically need a separate Command, Handler, and unit test for each Entity member variable. For the Product Entity above, you would need 13 commands. That is 39 files vs the current 3. I understand that files are cheap; however, this may present a maintenance problem with so much boilerplate code. There will also be a performance penalty if you have to write to the DB on each Command execution, assuming you are not using Event Sourcing. |
From the Software Craftsmanship Slack channel #_craftsmanship
|
I'd say "each business intention". It's perfectly fine to have several values in a single command. Sometimes it's OK to have something like |
Hello, two little things:
For performance you can dispatch multiple actions in the same request, and using a database transaction to make a global commit for all the updates involved Also for the UI point of view, maybe you can take some insight from "task based UI" principles: https://cqrs.wordpress.com/documents/task-based-ui/ which try to avoid long form (and CRUD interface) to instead display more "business intent oriented" user actions. |
Per the comment from Daniel in DDDinPHP
We may need to change these commands to support the Admin Panel HTML form to add and edit new products to the store:
The Admin Panel form:
The main application controller code (non open-source) to update a product:
The text was updated successfully, but these errors were encountered: