Download presentation
Presentation is loading. Please wait.
Published byAlfred Anderson Modified over 8 years ago
1
Executable UML The Models are the Code - Executable UML Lecture 6 - Associations Paul Krause
2
Executable UML Lecture 5 - Associations v Naming associations Binary non-reflexive associations v Binary reflexive associations v Association Classes v Loops and constraints
3
Executable UML Binary reflexive associations Command Name R1 0..1 is executed before 0..1 is executed after initialise align measure shutdown Command Script
4
Executable UML Different models capture different rules 1 43 2 S1 Shape Template SELECT Sheet with Applied Shapes TRANSLATE/ROTATE/SCALE AS1 AS2 AS3
5
Executable UML 1: Master Shape Template defines Shape Applied Shape X position on sheet Y position on sheet Scale Rotation Sheet Length Width Shape Template Name Control Point X position in shape Y position in shape 1 0..* 1 1 1..* 0..1 appears on displays defines is defined by specifies vectors for vectors are specified by precedes follows R3 R2 R1 R4 Constrains linked Control Points to be in the same Shape Template Editing a Control Point will change the shape of all the Applied Shapes defined by the respective Shape Template!
6
Executable UML 2: Shape copied from Shape Template Applied Shape X position on sheet Y position on sheet Scale Rotation Sheet Length Width Shape Template Name 1 0..* 1 1..* appears on displays specifies vectors for vectors are specified by R5 R7 Control Point X position in shape Y position in shape 0..1 precedes follows R4 {R5} Shape R6 A new Applied Shape is created by copying a Shape Template. The Control Points associated with instances of Applied Shape may now be independently edited.
7
Executable UML Associations capture application rules 1 43 2 S1 Shape Template SELECT COPY/EDIT 1 4 3 2 1 43 2 1 4 3 2 AS1 AS2 AS3 Applied Shapes See [Starr, 2002] pp 91-95
8
Executable UML Association Classes Flot - “flat optical thing” Laser Sensor
9
Executable UML Binary Association Flot Thickness Reflectance factor Laser Illuminator Station Intensity Frequency 0..1 is illuminating is being illuminated by R1 F1 : Flot L10 : Laser Illuminator Station Properties? Life cycle?
10
Executable UML Introduce an Association Class Flot Thickness Reflectance factor Laser Illuminator Station Intensity Frequency 0..1 is illuminating is being illuminated by R1 Flot Illumination Reflected intensity Transmitted spectrum Capture the dynamics of the illumination test process with this class
11
Executable UML Dynamics of an association Initiating IlluminationWaiting for LaserIlluminatingData CollectionPowering off LaserTerminating Flot Thickness Reflectance factor Laser Illuminator Station Intensity Frequency 0..1 is illuminating is being illuminated by R1 Flot Illumination Reflected intensity Transmitted spectrum
12
Executable UML Building a relationship to an association Flot Thickness Reflectance factor Laser Illuminator Station Intensity Frequency 0..1 is illuminating is being illuminated by R1 Flot Illumination Reflected intensity Spectrum describes transmitted frequency distribution of 1 1 transmitted frequency distribution is described by
13
Executable UML Three reasons for an association class v Assign attributes to an association v Build a relationship to an association A complex class model can often be simplified by introducing an association class and building relations from there v Model the lifecycle of an association
14
Executable UML Unconstrained association loops ChildSchool Parent 1..* is raised by 1..* raises 0..* 1..* 1 was formerly attended by formerly attended is attended byattends R2 R1 R3 The Parent who raises a Child may have formerly attended a different School (R2 --> R3) to the School attended by the Child (R1)
15
Executable UML Redundant Associations ChildSchool Parent 1..* is raised by 1..* raises 1..* 1 is attended by children raised by raises child who attends is attended byattends R2 R1 R4 The School is attended by Children who are raised by Parents (R1 --> R2) R4 is redundant!
16
Executable UML Redundant associations ChildSchool Parent 1..* is raised by 1..* raises 1..* 1 is attended byattends R2 R1
17
Executable UML Equal Set Constraints ChildSchoolDistrict 1..* lives in 1..* is residence of 1 1..* 1 is administered by administers is attended byattends R5 R1 R6 Policy: The District that administers the School a Child attends, must be the same as the District in which the Child lives.
18
Executable UML Equal Set Constraints ChildSchoolDistrict 1 lives in 1..* is residence of 1 1..* 1 is administered by administers is attended byattends R5 R1 R6 ASL constraint on instances of Child: select one schoolDistrict related by self -> School[R1] -> District[R6] select one residenceDistrict related by self -> District[R5] return [schoolDistrict == residenceDistrict]
19
Executable UML Executable UML Relationship Types Binary Non-reflexive Binary reflexive Association Class Generalisation {disjoint, complete}
20
Executable UML Why no aggregation and composition? v They are vague and imprecise v Active verb phrases give you all you need v See the Lab Exercises for examples
21
Executable UML For you to do v Read Chapters 6 and 8 of Mellor and Balcer v Next week - Get a Lifecycle…
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.