Advanced Classes and Relationships
Advanced Classes and Relationships
1
Outline
What is “Classifier”
Special properties of attributes and
operations and different kinds of classes
What is “Relationship”
Important relationships in UML
2
What is Classifier
3
What is Classifier cont.
egb_server <<subsystem>>
kernel32.dll Customer Service subsystem
4
Special properties of attributes and
operations
Visibility
Public[+]: any outside classifier with visibility to the given
classifier can use this feature.
Protected[#]: any descendant of the classifier can use the
feature.
Private[-]: only the classifier itself can use the feature.
Toolbar
public #currentSelection protected
#toolCurrent
+pickItem()
+addTool()
+removeTool()
protected +getTool()
#checkOrphans()
private -compact() 5
Special properties of attributes and
operations
Scope
The owner scope of a feature specifies whether
the feature appears in each instance of the
classifier or whether there is just a single
instance of feature for all instances of the
classifier.
instance : each instance holds its own value.
classifier : just one value for all instances. [static]
Frame
instance scope
header : FrameHeader
class scope uniqueID : Long
6
Abstract, Root, Leaf and Polymorphic
Elements
Icon base class
{root}
Origin : Point
abstract operation
diaplay()
getID() : Integer {leaf}
abstract class concrete operation
RectangularIcon ArbitraryIcon
height : Integer edge : LineCollection
width : Integer
isInside(p : Point) : Boolean abstract class
Hint
OKButton
• italic - abstract {leaf}
7
• default polymorphic display() leaf class
Multiplicity
NetworkController 1 ControlRod 3
8
Attributes
The syntax of an attribute in the UML is
[ visibility ] name [ multiplicity ] [ : type ] [ = initial-value ] [ { property-string } ]
9
Operations
The syntax of an operation in UML is
[ visibility ] name [ ( parameter-list ) ] [ : return-type ] [ { property-string } ]
[ direction ] name : type [ = default-value ]
in, out, inout : means parameter may be modified or not.
Map
12
Dependency
16
Generalization
A generalization is a relationship between a
general thing and a more specific kind of that
thing.
multiple inheritance
InterestBearingItem InsurableItem
multiple inheritance
Asset
singe inheritance
18
Association
Navigation : adorning an association with an
arrowhead pointing to the direction of traversal.
Visibility : objects at that end are not accessible
to any objects outside the association.
association
* * 1 *
UserGroup User Password
+user +owner -key
association visibility
19
Association
* 0..1
WorkDesk jobID : Int ReturnedItem
Constraints
1. implicit: The relationship is not manifest but, rather, is
only conceptual.
2. ordered: the set of objects at one end of an
association are in an explicit order.
3. changable: links between objects may be changed.
4. addOnly: new links may be added from an object on
the opposite end of association.
5. frozen: a link added may not be modified or deleted.
6. xor: over a set of associations, exactly one is manfest
for each associated object. 21
Realization