L14 l15 oo dbms

download L14 l15  oo dbms

of 48

  • date post

    19-Jan-2015
  • Category

    Technology

  • view

    87
  • download

    6

Embed Size (px)

description

 

Transcript of L14 l15 oo dbms

  • 1. Rushdi Shams, Dept of CSE, KUET Database SystemsDatabase Systems Object Oriented DatabaseObject Oriented Database Management SystemsManagement Systems Version 1.0Version 1.0

2. Rushdi Shams, Dept of CSE, KUET Object- TheoryObject- Theory An object is a package of data and procedures.An object is a package of data and procedures. Data is contained in attributes of an objectData is contained in attributes of an object Procedures are defined in methods of an objectProcedures are defined in methods of an object 3. Rushdi Shams, Dept of CSE, KUET Object- TheoryObject- Theory Concept of ClassConcept of Class 4. Rushdi Shams, Dept of CSE, KUET Objects- TheoryObjects- Theory Concepts of ObjectsConcepts of Objects 5. Rushdi Shams, Dept of CSE, KUET Object Types in OracleObject Types in Oracle Concept of ClassConcept of Class 6. Rushdi Shams, Dept of CSE, KUET Objects in OracleObjects in Oracle When you create a variable of an object type,When you create a variable of an object type, you create an instance of the type and the resultyou create an instance of the type and the result is an objectis an object An object has the attributes and methodsAn object has the attributes and methods defined for its typedefined for its type an object instance is a concrete thing, you canan object instance is a concrete thing, you can assign values to its attributes and call itsassign values to its attributes and call its methodsmethods 7. Rushdi Shams, Dept of CSE, KUET Objects in OracleObjects in Oracle rushdirushdi person_typ;person_typ; will create an object named rushdi of typewill create an object named rushdi of type person_typ.person_typ. 8. Rushdi Shams, Dept of CSE, KUET Question at the stageQuestion at the stage How the property ENCAPSULATION reflectsHow the property ENCAPSULATION reflects in OODM?in OODM? What is the difference between object type andWhat is the difference between object type and object in Oracle?object in Oracle? What is the relation between Oracles objectWhat is the relation between Oracles object type and OOPs class?type and OOPs class? 9. Rushdi Shams, Dept of CSE, KUET Object Type is a Data Type!Object Type is a Data Type! Defining an object type does not allocate anyDefining an object type does not allocate any storagestorage After they are defined, object types can be usedAfter they are defined, object types can be used in SQL statements in most of the same placesin SQL statements in most of the same places you can use types like NUMBER oryou can use types like NUMBER or VARCHAR2VARCHAR2 10. Rushdi Shams, Dept of CSE, KUET Object Type is a Data Type!Object Type is a Data Type! 11. Rushdi Shams, Dept of CSE, KUET Question at the stageQuestion at the stage An object type is a data type- justify theAn object type is a data type- justify the answer.answer. 12. Rushdi Shams, Dept of CSE, KUET Object Methods in OracleObject Methods in Oracle Methods are functions or procedures that youMethods are functions or procedures that you can declare in an object type definition tocan declare in an object type definition to implement behavior that you want objects ofimplement behavior that you want objects of that type to performthat type to perform The general kinds of methods that can beThe general kinds of methods that can be declared in a type definition are:declared in a type definition are: 1.1. MemberMember 2.2. StaticStatic 3.3. ConstructorConstructor 13. Rushdi Shams, Dept of CSE, KUET Member MethodsMember Methods Member methods are the means by which anMember methods are the means by which an application gains access to an object instance's dataapplication gains access to an object instance's data You define a member method in the object type forYou define a member method in the object type for each operation that you want an object of that type toeach operation that you want an object of that type to be able to performbe able to perform 14. Rushdi Shams, Dept of CSE, KUET Static MethodsStatic Methods Static methods are invoked on the object type,Static methods are invoked on the object type, not its instancesnot its instances You use a static method for operations that areYou use a static method for operations that are global to the type and do not need to referenceglobal to the type and do not need to reference the data of a particular object instancethe data of a particular object instance A static method has no SELF parameterA static method has no SELF parameter 15. Rushdi Shams, Dept of CSE, KUET Static MethodsStatic Methods You invoke a static method by using the dotYou invoke a static method by using the dot notation to qualify the method call with thenotation to qualify the method call with the name of the object type, such as:name of the object type, such as: type_name.method()type_name.method() 16. Rushdi Shams, Dept of CSE, KUET Constructor MethodsConstructor Methods Every object type has a constructor method implicitlyEvery object type has a constructor method implicitly defined for it by the systemdefined for it by the system A constructor method is a function that returns a newA constructor method is a function that returns a new instance of the user-defined type and sets up the valuesinstance of the user-defined type and sets up the values of its attributesof its attributes 17. Rushdi Shams, Dept of CSE, KUET Questions at the StageQuestions at the Stage What are the three methods that can be declaredWhat are the three methods that can be declared in object type definition?in object type definition? What is the difference between static methodWhat is the difference between static method and member method?and member method? What is the speciality about constructor method?What is the speciality about constructor method? 18. Rushdi Shams, Dept of CSE, KUET Inheritance- TheoryInheritance- Theory A type hierarchy is a sort of family tree of objectA type hierarchy is a sort of family tree of object typestypes It consists of a parent base type, called a superIt consists of a parent base type, called a super typetype one or more levels of child object types, calledone or more levels of child object types, called subtypessubtypes Child object types are derived from parentChild object types are derived from parent object classobject class 19. Rushdi Shams, Dept of CSE, KUET Inheritance- TheoryInheritance- Theory A subtype becomes a specialized version of theA subtype becomes a specialized version of the parent type by adding new attributes andparent type by adding new attributes and methods to the set inherited from the parent ormethods to the set inherited from the parent or by redefining methods it inheritsby redefining methods it inherits Redefining an inherited methods gives a subtypeRedefining an inherited methods gives a subtype its own way of executing the methodits own way of executing the method 20. Rushdi Shams, Dept of CSE, KUET Inheritance- TheoryInheritance- Theory 21. Rushdi Shams, Dept of CSE, KUET Inheritance- TheoryInheritance- Theory 22. Rushdi Shams, Dept of CSE, KUET PolymorphismPolymorphism Add to this that an object instance of a subtypeAdd to this that an object instance of a subtype can generally be substituted for an objectcan generally be substituted for an object instance of any of its supertypes in code, andinstance of any of its supertypes in code, and you have polymorphismyou have polymorphism 23. Rushdi Shams, Dept of CSE, KUET Final & Not Final- TypesFinal & Not Final- Types The definition of an object type determines whetherThe definition of an object type determines whether subtypes can be derived from that typesubtypes can be derived from that type To permit subtypes, the object type must be defined asTo permit subtypes, the object type must be defined as not finalnot final 24. Rushdi Shams, Dept of CSE, KUET Final & Not Final- TypesFinal & Not Final- Types By default, an object type is declared as final andBy default, an object type is declared as final and subtypes cannot be derived from itsubtypes cannot be derived from it You can change a final type to a not final type and viceYou can change a final type to a not final type and vice versa with an ALTER TYPE statementversa with an ALTER TYPE statement You can alter a type from NOT FINAL to FINALYou can alter a type from NOT FINAL to FINAL only if the target type has no subtypesonly if the target type has no subtypes 25. Rushdi Shams, Dept of CSE, KUET Final & Not Final- MethodsFinal & Not Final- Methods Methods can also be declared to be final or notMethods can also be declared to be final or not finalfinal If a method is declared to be final, subtypesIf a method is declared to be final, subtypes cannotcannot overrideoverride it by providing their ownit by providing their own implementationimplementation Unlike types, methods are not final by defaultUnlike types, methods are not final by default and must be explicitly declared to be finaland must be explicitly declared to be final 26. Rushdi Shams, Dept of CSE, KUET Final & Not Final- MethodsFinal & Not Final- Methods 27. Rushdi Shams, Dept of CSE, KUET Inheritance- OracleInheritance- Oracle Creating SubtypeCreating Subtype 28. Rushdi Shams, Dept of CSE, KUET Inheritance- OracleInheritance- Oracle Creating Subtype of subtypeCreating Subtype of subtype 29. Rushdi Shams, Dept of CSE, KUET Questions at the StageQuestions at the Stage What are the mechanisms Oracle use to reflectWhat are the mechanisms Oracle use to reflect the INHERITANCE of object orientedthe INHERITANCE of object oriented architecture?architecture? What is the significance of FINAL and NOTWhat is the significance of FINAL and NOT FINAL?FINAL? What is the difference of FINAL and NOTWhat is the difference of FINAL and NOT FINAL in case of object types and methods?FINAL in case of object types and methods? 30. Rushdi