OBJECTS Object Oriented ???????
OBJECTS
Object-Oriented n OO convenient label for a collection of interconnected ideas n OO approach views computer system as a collection of interacting objects n Objects viewed as things –things interact –people interact with things n Need to know what an object does n Component approach
Object-oriented Approach n Object-oriented analysis –defining all of the types of objects that are part of a users work environment n Object-oriented design –define all the types of objects in computer system and how they interact –UML n Object-oriented programming –programmers write statements that define types of objects –C++, JAVA, Small Talk
Object-oriented Approach con’t n Object databases - ultimate management system for multimedia, documents and other info. n Object brokers (Agents) - in distributed systems, allow objects to dynamically discover each other and interact across machines and through the web n Object frameworks - provide flexible, customizable, prefabricated software subsystems.
OO?? n Object Orientation - a set of design and development principles based on the idea of conceptually autonomous structures. Each autonomous structure represents a real world user's entity with the ability to interact with itself and other objects. n Object - an abstract representation of a real world entity that has a unique identity, embedded properties, and the ability to interact with other objects and itself. n Class - collection of similar objects with shared attributes and methods.
Core Model n Class –Object belongs to only one class –is an instance of the class –provides the basis for queries n Class Hierarchy and Inheritance –single inheritance -hierarchy –multiple inheritance- rooted and connected directed acyclic graph (DAG)
Core Model n Object Identifier –unique –system-wide n Attributes –value of attribute also object –domain is a class of attribute values n Encapsulation and Message Passing
Object-oriented concepts n Abstraction, encapsulation, information hiding. n Objects and attributes. n Object identity. n Methods and messages. n Classes, subclasses, superclasses, and inheritance. n Overloading. n Polymorphism and dynamic binding.
Comparison between Rel DB Obj DB n relations which are sets of tuples n Tuple components primitive types n Persistence n Backup & Recovery n Transactions n Concurrency n Security & Integrity n Administration n classes which are sets of objects n Object components complex types n Inheritance hierarchy n Methods n Methods integral part of class and inherited n DML and host language can be the same
Weaknesses of RDBMSs n Poor Representation of "Real World" Entities –Normalization leads to relations that do not correspond to entities in "real world". n Semantic Overloading –Relational model has only one construct for representing data and data relationships: the relation. –Relational model is semantically overloaded.
Weaknesses of RDBMSs n Poor Support for Integrity and Enterprise Constraints n Homogeneous Data Structure –Relational model assumes both horizontal and vertical homogeneity. –Many RDBMSs now allow Binary Large Objects (BLOBs).
Weaknesses of RDBMSs n Limited Operations –RDBMs only have a fixed set of operations which cannot be extended. n Difficulty Handling Recursive Queries –Extremely difficult to produce recursive queries. –Extension proposed to relational algebra to handle this type of query is unary transitive (recursive) closure, operation.
Weaknesses of RDBMSs n Limited Operations –RDBMs only have a fixed set of operations which cannot be extended. n Difficulty Handling Recursive Queries –Extremely difficult to produce recursive queries. –Extension proposed to relational algebra to handle this type of query is unary transitive (recursive) closure, operation.
Weaknesses of RDBMSs n Other Problems with RDBMSs –Transactions are generally short-lived and concurrency control protocols not suited for long-lived transactions. –Schema changes are difficult. –RDBMSs are poor at navigational access.
BENEFITS OF OODBMS n More semantic informatiom n Multimedia, CAD, CAM n User defined data types n Versioning n Class Reusability n Faster development (inheritance, reusability) n Portability
DRAWBACKS TO OODBMS n Still developing n Lack of standards n Is there a sufficient theoretical foundation? n Is this a throwback to hierarchical systems n No ad hoc query language n No set of tools n Steep learning curve
CURRENT DATABASE FEATURES n Language –DDL –DML –DCL n Concurrency Control n Recovery n Utilities
13 Rules for an OODBMS from the OODBS Manifesto n System must support complex objects n Object identifier must be supported n Objects must be encapsulated n Systems must support types or classes n System must support inheritance n System must avoid premature binding n System must be computationally complete
LAST 6 RULES n System must be extensible n System must be able to remember data locations n System must be able to handle very large databases n System must support concurrent users n System must be able to recover from hardware and software n Data query must be simple
Key Tensions n Two data models needed –object model (data & programs) vs. relational model (data & constraints) –Must one model dominate? Are they built simultaneously? –relational model needs some object features n Impedance mismatch –object-at-a-time navigation vs. set-at-a-time queries –programmatic vs. declarative integrity enforcement n Concurrency discordance –single image vs. shared database mindset n Interoperability –what other applications must use database?
Commercial OODBMSs n GemStone from Gemstone Systems Inc., n Itasca from Ibex Knowledge Systems SA, n Objectivity/DB from Objectivity Inc., n ObjectStore from eXcelon Corp., n Ontos from Ontos Inc., n Poet from Poet Software Corp., n Jasmine from Computer Associates/Fujitsu, n Versant from Versant Object Technology.
NEXT GENERATION DB SYSTEMS NEED THE ABILITY TO: n represent and manipulate complex nested objects n store and retrieve long data n define and manipulate arbitrary data types n represent and manage changes over time (versions) n represent semantic modeling concepts n specify rules and extended constraints n manage long-duration cooperative transactions
Relationships n Relationships represented using reference attributes, typically implemented using OIDs. n Consider how to represent following binary relationships according to their cardinality: –1:1 –1:* –*:*.
1:1 Relationship Between Objects A and B Add reference attribute to A and, to maintain referential integrity, reference attribute to B.
1:* Relationship Between Objects A and B u Add reference attribute to B and attribute containing set of references to A.
*:* Relationship Between Objects A and B n Add attribute containing set of references to each object. n For relational database design, would decompose *:N into two 1:* relationships linked by intermediate entity. Can also represent this model in an ODBMS.
*:* Relationships
Alternative Design for *:* Relationships