R – Database modelling or database design: Which comes first

data modelingdatabase-designdnsnhibernateschema

I would like to know which is the common practice for a domain implementation. Designing the business objects first, that need persistence or the database schema first, generating it from an entity relationship diagram (and afterwards the ORM poco*'s)?

I am going to start a solution, but I would like to know which is the most preferable "pattern".

(*powered by NHibernate)

Best Answer

Depends on whether you're an object or relational modeler. Preference is dictated by what you know best.

I'm an object person, so I'd say model the problem in objects and then get the relational schema from that.

I think there are lots of issues around data that aren't addressed by objects (e.g., indexing, primary and foreign keys, normalization) that say you still have some work to do when you're finished.

But any relational person will argue that they're primary and should be in the driver's seat.

I doubt that there will be a definitive answer to this one. I don't believe there should be. There's an object-relational impedance mismatch that's real. Objects are instance-centric; relational models are set-based. Both need careful consideration.

Related Topic