Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dynamic modeling, Tue 26.6.2001 G. Falquet, L. Nerima.

Similar presentations


Presentation on theme: "Dynamic modeling, Tue 26.6.2001 G. Falquet, L. Nerima."— Presentation transcript:

1 Dynamic modeling, Tue 26.6.2001 G. Falquet, L. Nerima

2 ISIISI June 2001 - G. Falquet, L. NerimaClasses 2 Outline vMore on classes generalization and inheritance vThe link between static (class) and behavioral modeling vInteraction diagrams vCollaboration diagrams vStates and state charts vSequence diagrams vExercices

3 ISIISI June 2001 - G. Falquet, L. NerimaClasses 3 More on generalization vGeneralization: taxonomic relationship vhierarchy: parent – children (superclass – subclass) vsimplest case: a class has a single parent vmore complicated: a class has more than one parent vthe child inherits (from all its parents): vstructure (attributes + associations) vbehavior vconstraints

4 ISIISI June 2001 - G. Falquet, L. NerimaClasses 4 Generalization: aims To share  Attributs (statique)  Operations (behavioral) To specify that more specific classes inherits from the more general class

5 ISIISI June 2001 - G. Falquet, L. NerimaClasses 5 Criteria for building taxonomies vmany shared elements (structural and behavioral) vbut significative differences must exist between the children vExample Shape origin move() resize() RectangleCircle Polygon Corner Display() Radius Display() Points Display() Resize() Square

6 ISIISI June 2001 - G. Falquet, L. NerimaClasses 6 vIn theory, every attribute can be substituded by a level of subclass... v... but probably the solution below is preferable Counterexample Car type colour Sports car Red sports car Silver sports car Blue sports car... Car Limousine...

7 ISIISI June 2001 - G. Falquet, L. NerimaClasses 7 vPrinciple: choose the criteria that maximize common elements vExample: Generalization with covariance Employee TechnicallProfessional Permanent Temporary The type of employee classes (professional or technical) shares more structural elements (attributes, association,…) Permanent Temporary

8 ISIISI June 2001 - G. Falquet, L. NerimaClasses 8 Employee Technicall Professional Permanent Generalization with covariance (cont) The type of employee position (permanent or temporary) shares more structural elements (attributes, association,…) Temporary Professional Technicall

9 ISIISI June 2001 - G. Falquet, L. NerimaClasses 9 Multiple inheritance or simple heritance ? Employee Professional Technical PermanentTemporary {disjoint} Temporary technical Permanent professional Temporary professional Permanent technical - Expressive modeling - Implementation: C++ supports multiple inheritance, Java does not

10 ISIISI June 2001 - G. Falquet, L. NerimaClasses 10 Employee Professional Technical PermanentTemporary {disjoint} Multiple inheritance or simple heritance ? - An instance in Employee class will have two instances in child classes: one in Professional/Technical, one in Permant/Temporary - Implementation: difficult (no prog. language supports this feature) - class migration not supported

11 ISIISI June 2001 - G. Falquet, L. NerimaClasses 11 Multiple inheritance or simple heritance ? Employee Professional Technical Position type An attribute can also be solution Is it a good solution ? Modeling test: - do permanent/temporary employees participate to the same associations ? - are the behaviors (more or less) the same, eg salary calculation, pension ?

12 ISIISI June 2001 - G. Falquet, L. NerimaClasses 12 Constraint on a set of generalizations vdisjoint vno element may have two children voverlapping v an element may have two or more children vcomplete vall possible children have been enumerated vincomplete vall possible children have not been enumerated yet vDefault: disjoint, complete (may be redefined)

13 ISIISI June 2001 - G. Falquet, L. NerimaClasses 13 Examples Shape Polygon Ellipse Spline {disjoint, incomplete} Athlete Swimmer Skier {overlapping, incomplete}

14 ISIISI June 2001 - G. Falquet, L. NerimaClasses 14 Class Diagram recapitulation vTypical use of class diagram 1)To model the vocabulary of a system 2)To model the static view of a simple collaboration (set of classes that work together to provide a behaviour) 3)To model a logical database schema

15 ISIISI June 2001 - G. Falquet, L. NerimaClasses 15 The link between class and behavioral diagrams vThe realization of a use case by a collaboration vAn example of collaboration in AT3 consumptio n checking Check vehicule consumption realization collaboration Use case

16 ISIISI June 2001 - G. Falquet, L. NerimaClasses 16 Collaboration vA collaboration gives a name to a conceptual building block of the system vA collaboration encompass vstatic elements vbehavior elements vNote: a collaboration doesn’t own any of its structural elements (it references the classes, interfaces, …)

17 ISIISI June 2001 - G. Falquet, L. NerimaClasses 17 vmainly classes v+ interfaces, components, nodes vAT3 example: Collaboration : structural aspect Vehicle Model Tanking Set_Lit_Km(v,km,l) lit_per_Km() select_last(v) Fill up Vehicle model IVehicleConsumption lastCons() 1 * * 1 … … tankingDate kilometers liters ISet_Lit_Km

18 ISIISI June 2001 - G. Falquet, L. NerimaClasses 18 Collaboration: behavioral aspect vUse an interaction diagram vcollaboration -> emphasis on structural relationship of collaborating objects vor sequence -> emphasis on time ordering of messages

19 ISIISI June 2001 - G. Falquet, L. NerimaClasses 19 Behavioral aspect of collaboration vExample of collaboration diagram :ISet_Lit_Km :Tanking Set_Lit_Km(v,l,km) :IVehicleConsumption v : Vehicle lastCons() select_ last(v) :Driver :Mechanic lit_per_Km() Tanking: Class

20 ISIISI June 2001 - G. Falquet, L. NerimaClasses 20 Behavioral aspect of collaboration vExample of collaboration diagram :ISet_Lit_Km :Tanking 1:Set_Lit_Km(v,l,km) :IVehicleConsumption v : Vehicle 2:lastCons() 3:select_ last(v) Tanking: Class 4:lit_per_Km() :Mechanic :Driver


Download ppt "Dynamic modeling, Tue 26.6.2001 G. Falquet, L. Nerima."

Similar presentations


Ads by Google