Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Create Request/Response DTOs for Application Services #4

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

Create Request/Response DTOs for Application Services #4

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant