Hacker News new | ask | show | jobs
by mrottenkolber 4203 days ago
Not a OOP wizard but from my experience ORMs tightly integrate with both your objects and your DB. So a "DataMapper" would indeed be my choice for a sane "persistence-layer" assuming:

* The objects don't know about the mapper * The DB doesn't know about the mapper

The "ideal DDD aggregate store" with a "schemaless type of store such as JSON" on the other hand binds the implicit schema to your objects. Seems more interlocking and less modular to me.

E.g. I'd rather settle on "this Mapper is the bridge, whatever it does" instead of "the bridge is implicitly defined by however I entangle objects and store".

Boils down to the old inheritance vs composition.

1 comments

I'm not disagreeing, but I guess I was comparing a relational schema to a JSON "schema".

I do agree a mapper is less intrusive than either. I think I have a bias right now because I've been working on an event sourced model that's using JSON as the serialization mechanism :).