What's the difference between data model and object model?
CWM is data modeling
UML is object modeling.
Can someone explain the difference that a layma开发者_如何学运维n can understand?
Object Model: deals with object oriented "blue-print" of your system. This includes, class diagrams (classes you will be creating), relationship between these classes, methods in the classes, properties etc.
Data model: deals with entities at the database level. Like how the classes in the OM will get stored in the database, in which tables etc. So DM deals with Table schema, relationship between different tables (PKs, FKs) etc.
DM does not have complex OO features like polymorphism, inheritance, overloading etc which are usually listed in an OM.
As a rough example, two classes in the OM can get stored (mapped) to a single Table in the DM, like both Employee and Manager persons can be stored in a single DB table.
Data modeling deals with the design and creation of your database structure, ie. how the data is stored.
Object modeling deals with how the application interacts with the information received from an external source, e.g. an end-user, a database, a web service, etc.
Let's say, for example, you are tracking customer history for the sales department. The department needs the customer's name, address, phone, email, and purchase history.
In the data model, you define the tables and fields that will store each individual piece of data. In that definition, you may include information like the maximum length, data type or whether or not the data is required.
In the object model, in addition to enforcing the rules you set up in the data model, you may also add additional behaviors, such as making sure that the email address is formatted correctly, or capitalizing the first letter of the customer's first and last name. These type of rules tend to be more complex and detailed than the rules set within the data model.
At any rate, the purpose of the object model is to ease the management of the data within the application itself and to perform higher-level validation on the data before it gets sent to the database.
精彩评论