Beruflich Dokumente
Kultur Dokumente
Goals
Provide users with an expressive modeling language
for the specification, construction, visualization and documentation of the
artifacts of a software system
for the construction of different kinds of models
for the exchange of models
Diagrams
(5) Statechart Diagram
Requirements
Analysis Model
Design
[else]
[Test successful]
Start of Operation
[else]
[Start of operation successful]
Employment
[Maintenance necessary] [additional functionality required]
Models of the
Requirements Specification
Phase
Constructing the
Constructing the Constructing the
Problem Domain
Use Case Model Interface Model
Model
Problem
Use Case Interface
Domain
Model Model
Model
[else]
[no further use cases]
Results of the
Requirements Specification Phase
1 «UML»
Use Case Diagram
1 Use Case
Model
* Description of Use Cases
* UI Specification
1 Interface
Model
* Spec. of System Interfaces
Use Case Model
System, Actor and Use Case
Results of constructing the use case model:
global use case diagram
a detailed textual description for each use case
Use Case Diagram
CALENDARIUM
CALENDARIUM
query
appoint
ment export
appointm
ents delete
appointm
ent
change
User appoint
insert ment
appointm
ent
Actor (1/2)
Actors interact with the system
by using the system, i.e., by initiating the execution of
use cases
by being used by the system, i.e., by providing
functionality for realizing use cases
each actor is required to communicate with at least one
use case
the communication relationship is undirected
Short Description:
insert
appointme
nt
of the participants. All participants must be notified of this new appointment. New appoint
Note
Relationships Between Use Cases
(1/4)
«include» -Relationship
the behavior of B
is included into A
the included use case B is necessary to ensure the
functionality of the base use case A
formerly called «uses» -relationship
«include»
A B
«extend» B
A
Relationships Between Use Cases
(4/4)
Generalization Relationship
similar to the generalization relationship between classes
B inherits the behavior of A and is allowed to
override and extend it
B inherits all relationships of A
modeling of abstract use cases is also possible
({abstract})
A B
base use case; sub use case;
is self-contained needs A (gets base functionality from A);
controls, what is executed from A
and what gets changed
Use Case Diagram
CALENDARIUM (refined, 1/2)
CALENDARIUM
query
entry export
entries delete
entry
change
User insert entry
entry «include»
«include»
«include» update
configur calenda
e notify r
Program participa «actor»
nts Fax-System
«extend»
configure
configur
paramete «actor»
e
rs E-Mail-
access administe
rights r System
administe users
r
Administrator
entry
types
Excursion (4/4)
Generalization Relationship between Actors
An actor A which inherits another actor B is
able to communicate with the same use
cases as B
Multiple inheritance also allowed
It can be distinguished whether multiple
actors have to communicate with a use
case in common or not
A A
A B A B
B B
Partitioning Use Case Diagrams
Package (1/3)
Large use case diagrams are becoming too
complex and confusing
(as is the case for all diagrams :-()
UML abstraction mechanism: Package
Criteria for partitioning:
Functional cohesion
Actors
«systemModel
«systemModel»
»
ExperienceCALENDARIUM
....
System Appointment
Administration Manager
Partitioning Use Case Diagrams
Package (2/3)
Appointment
Manager
query update
entry calender
«include»
«include» «include»
User insert change delete
entry entry entry
«include» «include»
«include»
notify
export
participa
entries
nts
«actor» «actor»
E-Mail-System Fax-System
Partitioning Use Case Diagrams
Package (3/3)
System Administration
«extend» configure
configure parameter
program s
User «extend»
administe configure
r access
users rights
administe
r
Adminis- entry
trator types
Class and Object
Class:
User
name: String
Attributes authorization: Right
pwd: String
number: Integer Class Attribute
Operations validatePW (PW: String): bool
computeNumber(): Integer
Class Operation
Object: Name
aUser of object
aUser (and class)
: User is
: User
underlined
Characteristics of a Class
Class attributes/operations: underlined
Properties of attributes:
“/” attribute name: derived attribute
{optional}: null values permitted
Properties of operations:
{query}: operation without side effects
{sequential}, {guarded}, {concurrent}: kind of
concurrency
Visibilities:
+ ... public
- ... private
# ... protected
Abstract Class
Cannot be instantiated
Useful for generalization hierarchies only
Factors out common properties of subclasses
Entry or Entry
{abstract}
The same notation is used in order to distinguish
between abstract operations and implemented
operations
Excursion (1/3)
Identification of Classes
Linguistic analysis of the problem
description - extraction of nouns
Rules of thumb:
elimination of irrelevant terms
elimination of names of values
elimination of vague terms
identification of attributes
identification of operations
elimination of terms which are in fact relationships
Rules of thumb:
attributes describe objects and should be neither class-
valued nor multi-valued
derived attributes should be marked as such
context-dependent attributes should be assigned to
associations rather than to classes
The list of attributes is usually incomplete in
the problem description
[cf.: R.J. Abbott, Program Design by Informal
English Descriptions, CACM, Vol. 26, No. 11, 1983]
Classes in Different Phases
Requirements Specification: Design:
Appointment «entity»
/ visualization: Color Appointment
start: DateTime {persistence=persistent}
description: String - startDate: Date
duration: Time - startTime: Time = “09:00”
hyperlink[0..1]: URL - duration: Time = “01:00”
type: AppointmentType - description: String = ""
numberOfAppointments: Int +visualization(): Color
+collidesWith (t:
{visualization = colorCode(type)} Appointment):
startTime))
t.startTime+t.duration ≤ bool
Note ∨
(t.startTime ≥ startTime+duration ...
≅ ¬(t.startDate=startDate
Association (1/3)
Association between classes
association name (optional)
arrow above each edge expresses reading direction (optional)
arrow at the end of an edge expresses navigation direction
(optional)
each end of an association is defined by means of multiplicity
for a binary association, the multiplicity on the target end
contrains how many objects of the target class may be
associated with a given single object from the other (source)
end
1..* attachedTo *
Calendar
Appointment
attachedTo
Link between objects a1:Appointment
aCalendar :
aCalendar :
represents an instance
Calendar
of an association attachedTo a2:Appointment
Association (2/3)
Multiplicity
arbitrary number “ * ”
a range is specified by means of “ .. ”
possible numbers are separated by means of
commas
exactly 1: 1
0: * (or 0..*)
0 1: 0..1
fixed number (e.g. 3): 3
range (e.g. 3 or more): 3..*
range (e.g. 3-6): 3..6
enumeration (e.g. 3,6,7,8,9): 3, 6..9
Association (3/3)
Role
Classes play roles within associations
a single class can play more than one role
refers to
married to
1..* participates *
User Appointment
participant
{subset} *
coordinator 1
coordinates
Qualified Association
A Qualifier is an attribute or a list
Bank Bank
of attributes * account#
whose values partition the objects
of the associated class in a disjoint* *
0..1
manner Person Person
in most cases, multiplicity is reduced to one
GroupOfParticipant 1 manages 1
groupName User
s Owner name
*
Participant 1..*
consistsOf
N-ary Association
Relationship between more than two classes
navigation direction cannot be specified
Calendar
* *
User AppointmentType
Authorization association
class
set of [r, w, d]
validateAuth(...)
Aggregation
Aggregation is a special kind of association
having the following properties:
Transitivity:
C is part of B and B is part of A ⇒ C is part of A
Anti-Symmetry:
B is part of A ⇒ A is NOT part of B
Properties:
a certain part can be incorporated at a certain time in
at most one composite object only
the parts are dependent on the composite object
propagation semantics
the composite objects form 1a tree
Graphic * *
Document * Annotation
Paragraph
* *
Generalization (1/2)
is a taxonomic relationship between a
specialized class and a more general class
the specialized one inherits all properties of the
generalized one
additional properties can be added
an instance of the subclass can be used wherever an
instance of the superclass is allowed (at least
syntactically)
multiple University
inheritance is also allowed:
Member
{overlapping}
Technical Administrative
Appointment SerialEntry ToDoEntry Employee Employee
Generalization of Associations
Used for restricting the possible links
between objects whose superclasses are
associated with each other
1 visualizes 0..1
Entry B_Entry
ToDoEntry B_ToDoEntry
Appointment B_Appointment
Template Class
A template class describes a “family” of
classes on the basis of formal parameters
each class is specified by binding the parameters with
actual values
length: 0..k
...
putAt (e: T, i: Int)
Alternative 1: at (i: Int): T Alternative 2:
«bind» (Point,3)
Array<Point,3>
ListOfPoints
Interaction Diagrams
Illustrate the communication between objects
Purpose:
Specifying the realization of an operation
Specifying the realization of a use case
2 Kinds:
generic kind, i.e., all possible scenarios are described by means
of branching and iteration
exemplary kind, i.e., one certain scenario is described
Interaction Diagrams
Sequence and Collaboration Diagram
Both specify the same information
However, each emphasizes different aspects
a2:Appointment
deleteAppt(“a2”)
delete()
totalDuration()
a = 1 .. nOfAppts
type()
return(aType)
[aType private] duration()
return(meetingTime)
return(total)
Interaction Diagrams
Collaboration Diagram
a2:Appointment
{destroyed}
2: deleteAppt(“a2”) 2.1: delete()
a:Appointment : Appointment
Interaction Diagrams
Relationships & Roles in Collaboration Diagrams
The kind of relationship between sender object
and receiver object may be specified (::
Sequence Diagram!)
attribute «association» (default)
global variable «global»
local variable (temporary object) «local»
parameter «parameter»
self referencing «self»
readAuthorization( )
:Calendarium : User
loggedInUser
«local»
Statechart Diagram
describes
the life cycle of the instances of a class
the execution of an operation on an instance of a class
models
the possible states of the instances of a class
the possible transitions from one state to another one
the events firing transitions
the operations (actions and activities) which are executed
within states or during a transition
Statechart Diagram
Kinds of Events
cancel () delete
delete ()
Finished
when(start+duration<=now)
Statechart Diagrams
State
State:
s
state (in the strict sense)
final state
Pseudostates:
initial state
history state, synch state, fork, join etc.
Action and Activity:
action: atomic and non-interruptible
activity: complex (possibly nested statechart diagram) and
interruptible
Action / Activity within a state:
entry / action action is executed when entering the state
exit / action action is executed when leaving the state
do / activity activity is executed, parameters are allowed
event / action event is handled within the state
Statechart Diagram
State Transition
modeButton()
inc()
modeButton
Statechart Diagram
Refining Statechart Diagrams
Refinement of a state by means
of a nested statechart
diagram
disjoint substates Z
(OR-refinement)
exactly one substate is active in case A
that the superordinate state (complex
state, super state) is active
B
parallel substates
(AND-refinement)
all substates are active in case that the Z
super state is active;
the substates are again or-refined A
B
Statechart Diagram
Example “Appointment” (1/2)
cancel
Cancelled
new delete
Enter Details Active
Finished
when(start+duration<=now)
Distribution
Component Diagram
Describes SW-components and their
dependencies
source code components (can offer interfaces - Java)
binary code components (can offer interfaces - OLE)
executable code components: instances are represented
by means of deployment diagrams
Packages can contain components and vice
file2. java
versa file1.java
I
Compilation
Dependencies file3. java file4. java
Distribution
Deployment Diagram (1/3)
Calen-
Shows the actual HW configuration «internet» darium
Server
consisting of Calen-
nodes (processors (default), I/O, ...) darium
Client *
SW-components
processes DB
objects Server
and of the communication channels between
nodes
Properties of nodes can be denoted by means of«device»
Tape
tagged values and/or stereotypes
(e.g., capacity, reliability)
Distribution
Deployment Diagram (2/3)
Calen-
darium
Client 1 Calen-
darium
Server
DB
Calen- Server
darium
Client 2
Distribution
Deployment Diagram (3/3)
Objects - Processes - Components - Nodes:
Calendarium
Client
«internet» Calendarium
User Interface System Server
Administration
«access»
Applet «access»
Appointment Manager
b_calendarium
«access»
Calendar
«access» Server Program
t1:calThread
DBAcces calendarium ... appobj
DB-Server
s
(bold style: active objects)