我知道这两个概念有很大不同,我有机会与两者一起工作。但是,回答“当一个人设计数据库系统时,应该使用一个类图还是 ER-图?”这个问题,我仍然感到不舒服。...有人可以详细说明一下吗?
1 回答
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.