DOC PREVIEW
UNCP CSC 3800 - The Object-Oriented Model

This preview shows page 1-2-16-17-18-33-34 out of 34 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Why OO?OO Data ConceptsClassesDefining a ClassWriting and Using MethodsClass HierarchiesSlide 8UML Class Diagrams-1Slide 10UML Diagrams-2ODMG ModelODL-Class DeclarationsSlide 14Slide 15Slide 16Slide 17Slide 18Slide 19ODL-Attribute TypesODL-Structured TypesCollection TypesRelationshipsMethodsSubclassesRelationship ClassesSlide 27KeysOQL-Object Query Language-1OQL-FROM lineOQL-WHERE lineDeveloping an OO DatabaseSlide 33Defining the SchemaCSC 3800 Database Management SystemsTime: 1:30 to 2:20 Meeting Days: MWF Location: Oxendine 1237BTextbook: Databases Illuminated, Author: Catherine M. Ricardo, 2004, Jones & Bartlett PublishersFall 2009Chapter 8The Object-Oriented ModelDr. Chuck LillieWhy OO?Why OO?Traditional relational model does not represent complex data and relationships wellNeed additional support for advanced applicationsOO paradigm widely used for programming OO database provides persistent objects to correspond to temporary objects in programsExamples: Objectivity, GemStone, ObjectStore, VersantOO Data ConceptsOO Data ConceptsAn object has a state and a unique identifier◦Similar to an entity, but has methods in addition to attributes (data elements)◦Objects are encapsulated – data and methods form a unit with restricted access◦Only object’s methods have access to its data◦Object’s interface is visible to outside worldA literal has a state but no identifier – can be atomic (values of built-in types) or structuredClassesClassesA class is a set of objects having the same structure- same variables with the same datatypes, same methods, and same relationships◦Roughly equivalent to an entity type◦Includes data elements, operations and relationships◦Datatypes can be predefined atomic types (integer, real, char, boolean), more complex types, or user-defined typesSet of objects in a class is called the extent (like extension)◦Class extent is roughly equivalent to an entity set◦Objects in the class (instances, object instances, objects) are similar to entity instancesDefining a ClassDefining a ClassDefined by listing components◦Data members (attributes, instance variables)◦Member methods (functions or procedures that belong to the class)◦Relationships that the class participates in Simplified Example:class Person {attribute string name;attribute string address;attribute string phone;void setName(string newName); // methodstring getName( ); //methodrelationship Job hasjob; //relates to Job class}Writing and Using Writing and Using MethodsMethodsMethod written in OO language-Java, C++, etc.Ex:void setName(string newName){self.name = newName;}User’s program may have a Person objectPerson firstPerson = new Person( );Invoke method using Person objectfirstPerson.setName(‘Jack Spratt’ );firstPerson becomes “calling object”, referred to as self in methodClass HierarchiesClass HierarchiesClasses organized into class hierarchies◦Superclasses (base classes and subclasses)◦Each subclass has an isa relationship with its superclass similar to specialization and generalization in the EER modelSubclasses inherit the data members and methods of their superclasses, and may have additional data members and methods of their own Hierarchy diagram-See Figure 8.2◦Represent classes as rectangles◦Connect subclasses to isa triangle, and connect triangle to superclassPersonStudentFacultyUndergraduateGraduateisaisaFigure 8.2 A Class HierarchyUML Class Diagrams-1UML Class Diagrams-1Unified Modeling Language (UML) class diagrams - See Figure 8.5◦Rectangles for classes- 3 sections: class name, attributes, methods ◦Relationships – 2 typesAssociationfor uni- or bi-directional relationships between distinct classes (Ex Student – Faculty relationship)represented by directed line connecting rectangles, with optional name Any descriptive attributes of association in box connected to association line by dotted line (Ex grade in Student - ClassSection)Rolenames can appear on line, but placement is opposite that in E-R (Ex. Student hasAdvisor role appears next to Faculty)AggregationConnects parts to a whole, described by “is part of” (Ex ClassSection to Course)Represented by line with diamond on side of aggregateCan be given a name, or interpreted as “has”◦Reflexive association or reflexive aggregation shown by line back to same class, with rolenames (Ex Course)Person ---------------- pIdnameaddressphone---------------getName( )setName( )Student----------------creditsgpa----------------getCredits( )addCredits( )Faculty--------------ranksalary------------getRank( )getSalary( )Department----------------deptCodedeptNamedeptOfficephone----------------Course--------------cNocTitlecreditsdescription-------------ClassSection-----------------sectionEvaluation-------------dateraterNamerating-------------Undergradute-----------------major----------------getMajor( )setMajor( )Graduate-------------program------------getProgram( )TeachingAssistant--------------fundingSourceannualStipendgradeFigure 8.5 A UML Class DiagramUML Diagrams-2UML Diagrams-2Multiplicity indicators show cardinality & participation◦min..max, but place opposite to placement in E-R; no ( )◦Use * for M; use 1 for 1..1Generalization hierarchies◦Lines connect subclasses to superclass, with triangle at end, pointing to superclass◦Filled triangle for overlapping subclasses◦Open triangle (outline only) for disjoint subclasses◦Can write constraints in curly braces on line near triangle (Ex. {overlapping, optional} near Person class rectangle)Weak entity represented by rectangle with line to strong entity, with discriminator written in box below strong entity (Ex. date is discriminator for Evaluation)ODMG ModelODMG ModelObject Database Management GroupGroup of vendorsDeveloped standards for OO databasesStandards for ◦Object model itself◦Object definition language (ODL)◦Object query language (OQL)◦Language bindings for C++, Java, SmalltalkODL-Class DeclarationsODL-Class DeclarationsSee Figure 8.6Class declarations◦Begin with word class, then classname◦Optional extent and key declarations in parentheses◦List of attributes, methods, and relationships, all enclosed in curly braces extent ◦Set of object instances for that class that are stored in the database at a given time; the extension◦Like the name of the file where the objects in the class are


View Full Document

UNCP CSC 3800 - The Object-Oriented Model

Download The Object-Oriented Model
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view The Object-Oriented Model and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view The Object-Oriented Model 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?