Académique Documents
Professionnel Documents
Culture Documents
association
uses
UML
Associations
Company Job employer employee Person
Job salary
worker
Adornments:
binary association
ordering: {ordered} changeability: {frozen}, {addOnly} Manages visibility: +, #, navigability: direction of arrow interface specifier: :nameOfInterface
Constraints: e.g. {or}, {subset}
UML
1 Polygon 1
Point
GraphicsBundle
Other example: bicycles in shop (composition, physical aggregation) or in a catalog (catalog aggregation)
Dorothea Beringer, 1999 UML 3
Composition
Different yet equal representations:
Window
Dorothea Beringer, 1999
1 UML
Specialization- Generalization
Generalization is the taxonomic relationship between a more general and a more specific element (classes, use cases, interfaces, ) that:
is fully consistent with the first element and adds additional information.
Adornments:
{overlapping} or {disjoint} {incomplete} or {complete}
Elm Birch
Oak
Dependencies
A dependency relationship between two elements (e.g. classes) indicates that a change to the target element (e.g. deletion) may require a change to the source element.
ClassA
friend
ClassB
calls
ClassC
Element A does not function without element B: {uses} Historically different elements (new and old) on different abstraction levels but represent same concept: {trace} Element A calls functions of element B: {calls} Friend-relationship as used in C++: {friend}
Dorothea Beringer, 1999 UML 6
Dependency Graphs
Dependency graphs just show all dependencies between classes, often without keywords. Usage graphs only show all the use dependencies. How do you derive dependency graphs?
==> rather for quality analysis of existing models and software than for documentation Goals: minimize dependency on too many classes to improve maintenance maximize cohesion within and minimize coupling between classes (use dependencies) to decrease complexity
Dorothea Beringer, 1999 UML 7
CRC
CRC: Class - Responsibility - Collaboration
CRC-Cards are (together with some diagrams) cornerstone of RDD (responsibility driven design), an alternative to UML classes are found by looking for responsibilities classes are documented on cards by stating class name, responsibility and collaborators (attributes and operations are added later on in design) class diagrams are refactored (changing the structure of the diagram without changing its overall behavior) based on responsibilities and various quality criteria
==> add a compartment responsibility or put the responsibility into the class description and think in responsibilities ==> no good class diagram without at least one or two (major) refactoring (==> iterative process!)
Dorothea Beringer, 1999 UML 8
==> whole values and quantities belong are classes, operations on them belong into these classes and not into some containing class ==> do not mix concepts together into one object! ==> make small objects and group them into packages!
Dorothea Beringer, 1999 UML 9
Goals of Modeling
Different goals:
Goals determine the content ==> you better know your goal Examples for goals? (b: make list)
Different views:
The same model can be represented by various diagrams Possible views for specific goals?(d)
Dorothea Beringer, 1999 UML 10
triangle: Polygon
center = (0,0) vertices = ((0,0),(4,0),(4,3)) Dorothea Beringer, 1999
:Polygon
surface:Pane
moves
title:TitleBar
UML 11
Packages - Subsystems
Packages allow to group classes and other model elements
into subsystems (keyword <<subsystem>>) into a framework (keyword <<framework>>) <<system> contains all classes
<<subsystem>> Finances
<<subsystem>> Finances <<subsystem>> Finances Charge Account () Credit Account () Process Payments () Payment Status (): status
Dorothea Beringer, 1999 UML
<<subsystem>> Accounts
12
Packages - Dependencies
Examples of an architecture diagram showing subsystems and their dependencies:
<<subsystem>> Database
Dorothea Beringer, 1999 UML 13
Also: consider architecture of systems you are integrating with and architecture preferences of COTS subsystems.
Sequence Diagrams
A sequence diagram represents an Interaction, which is a set of messages exchanged among objects within a collaboration to effect a desired operation or result.
roles (object or group of objects)
op() ob1:C1 [x>0] foo(x) [x<0] bar(x) doit(w) ob3:C3 ob4:C4
Generic form
(shows all possible sequences of an interaction)
lifelines
conditionality, guards focus of control (control flow, duration of action)
ob2:C2 doit(z)
destruction of an object
diagram continues
Dorothea Beringer, 1999 UML 16
dial digit ... route ringing tone phone rings answer phone
description of actions
stop tone
stop ringing
17
UML
Messages
A message conveys information and triggers action in another (or the same) object and is represented by a call arrow.
message name: signature of method called (parameters and return values may be omitted) or name of signal/event sent procedure call: return from procedure call (may be omitted in procedural flow of control): asynchronous message: or simply for all messages: branching: several call-arrows with guard-conditions iteration: all messages in loop are marked Additional symbols and modeling rules: see UML-books
UML
18
Collaboration Diagrams
A collaboration diagram shows an interaction organized around the objects in the interaction, and their links to each other.
shows relationships among objects roles time is no separate dimension
No time axis sequence numbers are used for showing ordering of messages.
procedural flow of control: nested numbering according to call nesting non-procedural flow: non-nested numbering with predecessors to indicate order of messages and synchronisation among threads, details see UML-books
UML
19
call arrows
1: displayPositions(window) contents {new} localline 1.1.2: create(r0,r1) 1.1.3: display(window) :Line {new}
sequence numbers
self
1.1.1a: r0 := position()
1.1.1b: r1:=position()
left: Bead
1.1*[i:=1..n]: drawSegment(i)
Dorothea Beringer, 1999 UML
right: Bead
:Factory Mana
A2: complete
1 / A1: start(
:Robot
Dorothea Beringer, 1999 UML
:Oven
21
Context: Most often we model the interaction of the objects of a collaboration; the collaboration then shows the context in which the interaction occurs.
Dorothea Beringer, 1999 UML 22
Interaction diagrams can be on different levels of granularity, yet UML does not provide any modeling concepts to link the various diagrams.
Dorothea Beringer, 1999 UML 23
Completeness
Maintained documentation: Description or pseudo-code at the left-hand side? Operations with parameters and return-value? Also types in parameter list? For which scenarios of a use case? For which use cases?
Verification of analysis/design models: What is needed for verifying the models? Validation of models with customers and end-users: Which models or views would you like for validation that you are developing the right system?
Dorothea Beringer, 1999 UML 24
Statechart Diagrams
A statechart diagram represents a state machine which is a graph of states and transitions that describes the response of an object of a given class to the receipt of outside stimuli.
statecharts of David Harel with various extensions, e.g. from Petri Nets, OMT powerful and well accepted notation
Elements of statecharts:
composite states, concurrent states actions and activities, entry-actions, exit-actions, transition-actions, sending messages events, ChangeEvent, SignalEvent, CallEvent, TimeEvent simple transitions, complex transitions
UML
25
start state - end state within Dialing activities given by entry and exit action events can be methods of certain classes what does state diagram describe? a method, a class, ?
UML 26
(b: automatic transmission, effective gears, set gear, motor status, speed)
Dorothea Beringer, 1999
UML
27
history indicator: A2 is chosen the first time, later on resume goes to the state active before interrupt happened
UML
28
(b: add outermost start and end states: object is created and deleted, complete state diagram reflects whole life of object)
Dorothea Beringer, 1999 UML 29
Events (1)
An event is a noteworthy occurrence. For practical purposes in state diagrams, it is an occurrence that may trigger a state transition, e.g.:
receipt of a call for an operation by an object (CallEvent) object-name.operation-name (parameter-list) explicit signal from one object or subsystem to another (SignalEvent) ==> arbitrary high level signal-name (parameter-list), looks like CallEvent passage of a designated period of time after a specific other event (e.g. entry into current state) (TimeEvent) after (time) condition comes true (ChangeEvent) when (condition) (d: difference to guards, loosing events)
Signals:
can be represented like classes with keyword <<signal>> and a compartment for parameters build inheritance hierarchies
Dorothea Beringer, 1999 UML 30
Events (2)
Actions:
event-name (argument-list ) [ guard-condition ] / action-expressions ^ send-clauses any event names allowed, apart from keywords entry, exit, do guard-condition: boolean expression using parameters of the triggering event and attributes,links or states of object owning state diagram or of reachable (via links) object action-expression: atomic uninterruptible operation, operations are executed sequentially send-clause: destination-expression . operation-or-signal-name ( argument-list ) Example: right-mouse-down(location) [location in window] / object := pick-object(location) ^ object.highlight()
(d: how much to write down about a transition?)
Dorothea Beringer, 1999 UML 31
UML
32
Events (3)
Invocation of a nested state machine:
do / name_of_nested_state_diagram (argument-list) calls the state machine diagrammed somewhere else ==> one way to split up a diagram consider other activities as a nested state machines without diagram
Internal transition:
when event help occurs, action display help is carried out
help / display help
Activity Diagrams
An activity diagram describes the flow of control (and data) through the various stages (action states) of a procedure (operation, use case, ).
Is like a state diagram where the states are all action states and the transitions are automatic has characteristics of state-transition, data-flow, SDL and interaction diagrams has symbols for action states, branching, decisions, receiving and sending events, object flow, swimlines...
Used for:
describing algorithmic aspects of an operation of an object describing flow of data through the system describing actions of a use use either the whole activity diagram is owned by own object, or each object or group of object has a swimline
UML 34
UML
35
UML
36