0% found this document useful (0 votes)
4 views

Object Oriented Data Modeling

Uploaded by

signup90810
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Object Oriented Data Modeling

Uploaded by

signup90810
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

Object oriented Data modeling

What is object oriented data modeling


• It is built around objects and classes
• Involves inheritance
• Object encapsulates both data and behavior
Classes and Objects
• Class: An entity that has a well-defined role in the
application domain, as well as state, behavior, and
identity
– Tangible: person, place or thing
– Concept or Event: department, performance, marriage,
registration
– Artifact of the Design Process: user interface, controller,
scheduler

• Object: a particular instance of a class


– Objects exhibit BEHAVIOR as well as attributes
– Different from entities
State, Behavior, Identity
• State: attribute types and values
• Behavior: how an object acts and reacts
– Behavior is expressed through operations that can
be performed on it
• Identity: every object has a unique identity,
even if all of its attribute values are the same
OO vs. EER data modeling
• Object Oriented • EER
• Class • Entity type
• Object • Entity instance
• Association • Relationship
• Inheritance of Behavior • No representation of
behavior

Object-oriented modeling is typically


represented using the Unified Modeling
Language (UML)
UML Class diagram showing two
classes

Class diagram shows the static structure of an object-oriented


model: object classes, internal structure, relationships.
UML Object diagram with two
instances

Object diagram shows instances that are compatible


with a given class diagram.
Operations
• A function or service that is provided by all
instances of a class
• Types of operations:
– Constructor: creates a new instance of a class
– Query: accesses the state of an object but does not alter
its state
– Update: alters the state of an object
– Scope: operation applying to the class instead of an
instance
Association
• Association:
– Named relationship among object classes
• Multiplicity:
– How many objects participate in an association.
Lower-bound..Upper bound (cardinality)
Examples of association relationships of
different degrees
Lower-bound – upper-bound

Represented as:
I.0..1
II.0..*
III. 1..1
IV. 1..*

Similar to
minimum/maximum
cardinality rules in EER
Alternative
multiplicity
representation:
specifying the two
possible values in a
list instead of a range
Associative Class
• An association that has attributes or
operations of its own or that participates in
relationships with other classes

• Like an associative entity in ER model


Generalization and Specialization
• Subclass, superclass
– similar to subtype/supertype in EER
• Common attributes, relationships, and operations
• Disjoint vs. Overlapping
• Complete (total specialization) vs. incomplete
(partial specialization)
• Abstract Class: no direct instances possible, but
subclasses may have direct instances
• Concrete Class: direct instances possible
Employee superclass with three
subclasses
Abstract Patient class with two
concrete subclasses
Class-scope attriute
• Specifies a value common to an entire class,
rather than a specific value for an instance.

• Represented by underlining

• “=“ is initial, default value


Polymorphism
• Abstract Operation: Defines the form or
protocol of the operation, but not its
implementation
• Method: The implementation of an operation
• Polymorphism: The same operation may
apply to two or more different classes in
different ways
Aggregation
• Aggregation: A part-of relationship between a
component object and an aggregate object

• Composition: A stronger form of aggregation in


which a part object belongs to only one whole
object and exists only as part of the whole object

• Recursive Aggregation: Composition where


component object is an instance of the same
class as the aggregate object
A Personal Computer includes CPU, Hard Disk, Monitor, and Keyboard as
parts. But, these parts can exist without being installed into a computer.
The open diamond indicates aggregation, but not composition
Aggregation and composition

Closed diamond
indicates
composition. The
room cannot
exist without the
building

You might also like