Skip to content
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

Create Request/Response DTOs for Application Services #25

Open
JavierCane opened this issue Feb 12, 2019 · 0 comments
Open

Create Request/Response DTOs for Application Services #25

JavierCane opened this issue Feb 12, 2019 · 0 comments

Comments

@JavierCane
Copy link
Member

What

Instead of instantiating the Value Objects directly from the controller, we should instantiate a DTO such as SignUpUserRequest and pass it to the Application Service.

The Application Services intended for querying data, we should return also a DTO such as UserResponse.

Why

This way we:

  • Avoid coupling our entry points to the internal details on how we model out our domain (UserId value objects and so on).
  • Leave the code on the Hexagonal Architecture approach closer to what we'll do while evolving to an architecture applying CQRS concepts. We will only need to:
    • Replace the XxxRequest by their corresponding XxxCommand,
    • Send the commands to the Command Bus instead of directly calling the Application Service
    • Implement the Command Handler in order to extract each one of the scalar values from the Command, convert them to Value Object instances, and call to the Application Service
    • Modify the Application Service in order to directly receive the Value Objects instead of the XxxRequest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant