Data Modeling: Class vs. ER Diagram
I know that both concepts are alot different, and I have had the opportunity to work with both. However, I still开发者_开发问答 don't feel confortable answering the question "when one designs a database system, should one class-diagram or ER-diagram it?"... Can anyone please elaborate on this?
My two cents on the subjest, is always ER-design your database system.. why?
Classes and objects are a more natural way of expressing Domain Models (object abstractions of business domains, etc..) they will contain properties that map to or make more sense within the sphere of the business domain, they might also encapsulate logical operations on those properties.
Entity Model, indeed might be similar to the Object Domain Model (classes), but will not be polluted with certain business concepts that should exist only in the business domain.
This is more visible in the DDD (Domain Driven Development) world where, your domain model (classes) might contain objects such as ShippingStrategy and SalesTax, but the underlying data model might be completely agnostic to the idea of Shipping Strategies, and might only be concerned with Location, Shipper, Commodity, etc..
So in my mind I'd rather have a pure entity model for the database design.
Further more, when it comes to notation. Moving from ERM to database Schema is much easier than class diagram.
精彩评论