DTO (data transfer object) is just a data structure, it doesn’t affect “purity”.
Layers should be decoupled, so that changes in one of them don’t affect others. DTOs are one of the ways to do that.
In the domain layer, DTOs can be the domain entities themselves. In other—specific objects designed in a way to provide only as much information as needed.
(You can find out more about this in, for example, “Domain Modeling Made Functional” and “Domain Driven Design”.)
But again, not every project needs this. Smaller apps can live without that strict separation. Every solution depends on the particular problem 😃
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
DTO (data transfer object) is just a data structure, it doesn’t affect “purity”.
Layers should be decoupled, so that changes in one of them don’t affect others. DTOs are one of the ways to do that.
In the domain layer, DTOs can be the domain entities themselves. In other—specific objects designed in a way to provide only as much information as needed.
(You can find out more about this in, for example, “Domain Modeling Made Functional” and “Domain Driven Design”.)
But again, not every project needs this. Smaller apps can live without that strict separation. Every solution depends on the particular problem 😃