Skip to main content
4 events
when toggle format what by license comment
Jun 10, 2021 at 7:50 comment added Flater @qUneT: This is actually quite hard to write a hard and fast rule about, but it's quite intuitive. Compare the difference in expectation between these two classes, purely by their name: Person and MailSender. On a very basic level, you expect Person's main purpose to be to contain data which will be passed around, whereas MailSender's main purpose is to do something, when others tell it to do so. A DTO is, oversimplified, a "data carrying" object. Note, though that usually only the layer-crossing data carrying objects are called DTOs, not the layer-internal data objects.
Jun 10, 2021 at 6:30 comment added qUneT Thank you for your detailed reply, up until now I had the ambition to implement DDD without any framework ( in php ), but the more I learn about it the more I come to the conclusion that I really need them ( DI container, ORM etc... ) I'm still a bit confused about the DTO, a DTO does not have any behavior except for storage, retrieval, serialization and deserialization of its own data, so from this definition, a repository object can't be a DTO because a repository have behavior (accessing the persistence mechanism), can you clarify that?
Jun 9, 2021 at 8:01 history edited Flater CC BY-SA 4.0
added 1 character in body
Jun 8, 2021 at 8:28 history answered Flater CC BY-SA 4.0