130 likes | 227 Views
Objects. History Simula - 1960’s Smalltalk - 1970’s C++ - 1980’s Java - 1990’s Market OODBMS = $100M (Objectstore, Versant, Gemstone, O2, Objectivity, Poet) RDBMS = $4.5B (Oracle, Sybase, Informix, Microsoft, IBM). An object is a data structure. Data Behavior
E N D
Objects • History • Simula - 1960’s • Smalltalk - 1970’s • C++ - 1980’s • Java - 1990’s • Market • OODBMS = $100M (Objectstore, Versant, Gemstone, O2, Objectivity, Poet) • RDBMS = $4.5B (Oracle, Sybase, Informix, Microsoft, IBM)
An object is a data structure... • Data • Behavior • what operations the object can perform • how it responds to messages from other objects
OO Environment Message A Message B Method 1 Method 3 Data Data Method 5 Method 4 Method 2 Message C
OO Features • Complex objects • Identity • Encapsulation • Classes • Inheritance • Extensibility • Polymorphism Object Class Attributes Methods
Object Oriented Databases • Object • unique system generated object identifier • collection of procedures • regular data attributes • Messages • Encapsulation • Classes • Hierarchy • Inheritance • Polymorphism
Object Oriented Databases • Extensibility • Integer, Real, String, Date, Char, Boolean • Tuple, Set, List, Array, Bag • Image, Audio, Video • User Defined Abstract Data Types (!) • Persistence • Object state is implicitly saved
Object Behavior • Methods • objects are self-contained • supports object independence (private/public) • Msg: person.new person.firstName(“Chuck”) person.age return(year(today - birthdate))
Polymorphism • Object methods can have the same name and similar behavior, or same name and different behavior. • Example - computeYearlyEarnings • non-union vs. union employee
Querying OODBMS • Consider the table: • Person{LastName,Spouse,Mother,Father} • Find “David Jordan's” wife's mother's father (Grandfather in law?)
In SQL select f.last_name from Person me, Person sp, Person m, Person f where me.first_name = "David' and me.last_name = "Jordan" and me.spouse = sp.personId and sp.mother = m.personId and m.father = f.personId
In OQL David_Jordan->Spouse->Mother->Father->LastName
Another Example list of all the last names in the database that were not "Smith" or "Jones": OQL: select distinct LastName from Persons where LastName != "Smith" and LastName!= "Jones" SQL: select distinct LastName from Persons where LastName <> "Smith" and LastName <> "Jones"
When to use an OODBMS? • If the requirements analysis lends itself to object design, and the development language is object-oriented, then • If the data is not already stored in an RDBMS, then use OODBMS • Else, use O/RDBMS.