Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between data model and object model?

Tags:

CWM is data modeling

UML is object modeling.

Can someone explain the difference that a layman can understand?

like image 276
user198729 Avatar asked Mar 15 '10 09:03

user198729


People also ask

What are the 4 different types of data models?

There are four types of data models: Hierarchical model, Network model, Entity-relationship model, Relational model.

What is the object model?

An object model is a logical interface, software or system that is modeled through the use of object-oriented techniques. It enables the creation of an architectural software or system model prior to development or programming. An object model is part of the object-oriented programming (OOP) lifecycle.

What are the three types of data models?

The three primary data model types are relational, dimensional, and entity-relationship (E-R).


2 Answers

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.

like image 100
Vivek Avatar answered Oct 04 '22 09:10

Vivek


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.

like image 30
Neil T. Avatar answered Oct 04 '22 09:10

Neil T.