Is inheritance in data transfer objects bad practice?
Does dtos smooth out an approach that makes it easier to write client code? What's the best practice here?
+3
Newbie
source
to share
1 answer
The purpose of a DTO is to transfer data in a structured way. Inheritance tends to get in the way of this when trying to establish a data contract between client and server. You can do this, but it tends to be painful.
I recommend that you go with aggregation.
+7
Randolpho
source
to share