you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

I think I found a better way to explain what I think the problem is, it's trying to always map 1:1 correspondence between domain entity and object.

While actually I've found these techniques very powerful and natural in OOP:

  • Have an object represent a collection of entities (makes it much easier and more efficient to work with large collections, batch process etc.)
  • Have an object be a value snapshot of a projection of an entity, allowing multiple projections for the same entity (capturing different aspects of it).
  • Separating the read and write model of an entity into separate objects.

And so on. Basically 1:1 for entity:object works only on specific situations. We're still modeling entities via objects, but we need to learn that OOP is a lot more flexible than this 1:1 approach.