Professional Documents
Culture Documents
2
Object-oriented databases
Avoid object-relational impedance mismatch
5
Object-oriented concepts
Objects
An object is made of two things:
State: attributes (name, address, birthDate of a person)
Behaviour: operations (age of a person is computed from
birthDate and current date)
Objects are categorized by their type or class.
An object is an instance of a type or class.
7
Object-oriented concepts
Sharing of objects through references
Class
Provides a template for constructing objects.
Instances of a class have the same kind of data and
identical behaviour.
9
Object-oriented concepts …
An Example of a class in UML
age(): Integer
Operations
changeAddress(newAdd: string)
Encapsulation
Merger of data structure and
operations.
Objects are composed of
attributes (values) and operations
(behaviour).
11
Object-oriented concepts …
Inheritance
A class can be defined Person
name: {firstName: string,
in terms of another one. middleName: string,
lastName: string}
address: string
Person is super-class birthDate: date
age(): Integer
and Student is sub-class. changeAddress(newAdd: string)
13
Comparison – continued…
RDBs vs. ODBs.
Not very easy to compare because of
philosophical differences.
RDBs have only one construct i.e.
Relation, whereas the type system of
ODBs is much richer and complex.
RDBs require primary keys and foreign
keys for implementing relationships, ODBs
simply don’t.
14
Comparison – continued…
RDBs vs. ODBs.
ODBs support complex data whereas
RDBs don’t.
ODBs support wide range of applications.
ODBs are much faster than RDBs but are
less mature to handle large volumes of
data.
There is more acceptance and domination
of RDBs in the market than that for ODBs.
15
UML
Defining Class
A CLASS is a template (specification, blueprint)
for a collection of objects that share a common
set of attributes and operations.
HealthClubMember
attributes
Class operations
Objects
Relationships
A RELATIONSHIP is what a class or an object
knows about another class or object.
Class
{
Member
memberNumber
firstName Expanded view of a
lastName Class into its three
attributes telephone
address sections:
city
Top: Class Name
etc...
{
Middle: attributes
checkOutVideo
operations checkInVideo Bottom: operations
buyItem
etc...
Generalization Relationships
Person
A generalization connects a subclass
to its superclass. It denotes an
inheritance of attributes and behavior
from the superclass to the subclass and
indicates a specialization in the subclass
of the more general superclass.
Student
Generalization Relationships (Cont’d)
UML permits a class to inherit from multiple superclasses, although
some programming languages (e.g., Java) do not permit multiple
inheritance.
Student Employee
TeachingAssistant
Generalization (Class-to-Class) 22
Person
attributes
operations
Exactly one
Class 1..* One or more
Class
Class * Zero or more
0..1 Optional (0 or 1)
Class
Association Relationships
Student Instructor
1..*
Student Instructor
1..*
membership
Student Team
1..* 1..*
member of
1..* 1..*
Student Team
1 president of 1..*
Association Relationships (Cont’d)
We can constrain the association relationship by defining the
navigability of the association. Here, a Router object requests
services from a DNS object by sending messages to (invoking the
operations of) the server. The direction of the association indicates
that the server has no knowledge of the Router.
Router DomainNameServer
Association Relationships (Cont’d)
Associations can also be objects themselves, called link classes or
an association classes.
Registration
modelNumber
serialNumber
warrentyCode
Product Warranty
Association Relationships (Cont’d)
nex
t
LinkedListNode
previou
s
Engine
Car
Transmission
Scrollbar
1 1
Window Titlebar
1 1
Menu
1 1 ..
*
SaleItem RentalItem
0..*
Transaction 0..* Employee StoreLocation
1 1