Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 4 Advanced Class Modeling

Similar presentations


Presentation on theme: "Chapter 4 Advanced Class Modeling"— Presentation transcript:

1 Chapter 4 Advanced Class Modeling

2 Advanced Class Modeling
Advanced Objects and Class Concepts Association Ends N-ary Associations Aggregation Abstract Class Multiple Inheritance Metadata Reification Constraints Derived Data Packages

3 4.5 Abstract class Abstract class is a class that has no direct instances but whose descendant classes have direct instance Concrete Class is a class that is instantiable; it can have direct instances; can be leaf class in inheritance tree Its good idea to avoid concrete superclass All super classes are abstract and all leaf subclasses are concrete Can eliminate concrete superclasses by introducing an “other subclass” UML Notation: Class name in Italics Keyword {abstract } before/after the name

4 4.6 Multiple inheritance Permit a class to have more than one class
Advantage – Power in specifying classes & an increased opportunity for reuse Disadvantage – Loss of conceptual & implementation simplicity Concept – Generalization – Multiple Generalization Language – Inheritance – Multiple Inheritance

5 4.6.1 Kinds of Multiple Inheritance
Complete Disjoint Overlapping Incomplete UML Notation: Dotted Line cutting across the affected generalization with a constraint in {} Refer Book for diagram

6 4.6.2 multiple classification
One Instance to participate in two overlapping classes One VTU Professor taking class in IIT OO Languages handles it poorly, so workarounds will solve the same

7 4.6.3 Workarounds Delegation using composition of Parts
Inherit the most important class and delegate the rest Nested generalization Issues to be considered Superclass of equal importance – I Dominant Superclass – II & III Few Subclasses – III Sequencing generalization sets - III Large quantities of Code – Try to avoid - Dupe code & spoil OO Concepts Identity – III Preserve

8 4.7 Meta data Class Definition is a meta data Describes the data
Computer languages implements meta data heavily

9 4.8 reification Promotion of something that is not an object into an object Useful to promote attributes, methods, constraints and control information into objects, so that it can be manipulated and described as data Eg : Type cast in Programming lang Association Class “Works For”

10 4.9 Constraints A boolean conditions involving model elements like objects, generalization set, links Can be expressed using OCL Constraints on objects Constraints on Generalization Set Semantics of generalization imply certain structural constraints – Disjoint; Overlapping; Complete; Incomplete Constraints on Links Multiplicity; Qualification; Association Class; Constraints on Association End Ordered; Subset; Bags; Sequence Use of Constraint Measuring the quality of the class model “Good” Class Model Captures Important Constraints

11 4.10 Derived Data Function of one or more elements – derived attribute, association , classes A class model should generally distinguish independent base attributes from dependent derived attribute Use derived elements for implementation where they are compelling UML Notation – A slash in the front of the element

12 4.11 Packages Group of elements with a common theme
Packages are to organize large models so that the reader can understand portions of the model at a time, rather than having to deal with the whole model at once Tips for devising packages Carefully delineate each packages scope Define each class in a single package


Download ppt "Chapter 4 Advanced Class Modeling"

Similar presentations


Ads by Google