Sie sind auf Seite 1von 12

What is UML?

 Unified Modeling Language


 Comprehensive full life-cycle 3rd Generation modeling language
Standardized in 1997 by the OMG (Object Management Group)
Created by a consortium of 12 companies from various domains
IBM a key contributor to behavioral modeling
Essentials of IBM® Rational® Rhapsody® for Software Engineers  Incorporates state of the art Software and Systems A&D concepts
 Matches the growing complexity of real-time systems
UML v2.1 – Fundamentals Large scale systems, Networking, Web enabling, Data management
 Extensible and configurable
 Unprecedented inter-disciplinary market penetration
Courtesy of IBM Corporation Academic License  UML 2.1 is latest version

UML 2 diagrams Use case diagram


 This diagram shows what the system does and who uses
Package Class Activity it.
Structure Diagrams Diagrams Diagrams
Diagrams
state chart
Object Diagrams
Diagrams Behavioral
Structural Diagrams
Diagrams
Deployment Use Case
Diagrams Interaction Diagrams
Diagrams
Component Timing
Diagrams Diagrams

Communication Sequence
Diagrams Interaction Diagrams
Diagrams

3 4
Sequence diagram Class diagram
 Sequence Diagrams show how instances communicate Class diagrams show classes and relations between
over time. them.

5 6

Object diagram Structure diagram


 Object Diagrams show instances of classes and show  This diagram shows the internal structure of classes.
which ones are linked to others at run time.

7 8
state chart diagram Activity diagram
 state charts are used when you need to wait until  Activity diagrams are used to
something happens before going to a different state. describe behavior for operations,
classes, or use cases. As soon
as one activity finishes, the next
one starts.

9 10

Package diagram Communication diagram


 A package is similar to a folder and is used to organise  This used to be known as a Collaboration Diagram and is
the UML model elements. similar to a Sequence Diagram, but generally less
popular.

11 12
Component diagram Deployment diagram
 A component diagram shows how components such as  A Deployment Diagram shows how UML artifacts are
.exe, .dll, .lib, are interconnected. deployed onto hardware nodes.

13 14

Timing diagram Interaction overview diagram


 The Timing Diagram focuses on changing conditions  An Interaction Diagram is a mixture of an Activity
within and among objects on a linear time axis. Diagram and several Sequence Diagrams.
send(value)

Transceiver
Idle
Receiving
sd sd
Sending
Coil Driver
transm it(value) evDone
Receiving::High
Receving::Low {1 m s +/- 0.2m s}

Sending::High
Sending::Low
{3 m s +/- 0.2m s}
Tristate tm (bitTim e)

Monitor
send(value)
Initializing
Acquiring
ref
Reporting
dispatch_event
Idle

Time

15 16
How does UML apply to real-time? How do you describe structure using UML?
 Real-Time UML is standard UML
 “Although there have been a number of calls to extend UML for
the real-time domain … experience had proven this is not
necessary.” Bran Selic, Communications of the ACM, Oct 1999
 Real-time and embedded applications
 Special concerns about quality of service (QoS)
 Special concerns about low-level programming
 Special concerns about safety and reliability
 Real-time UML is about applying the UML to meet the
specialized concerns of the real-time and embedded
domains

17 18

What is an object ? What is an object ?


 An object is one of the common building blocks in a  Every object has:
UML model. It can represent a system, a subsystem or Responsibilities:
a specific software class in a programming language.  What does the object do? Why does it exist?
Attributes:
 Several definitions are available:  This is the internal data and can either be fixed in value or
 An object is a real-world or conceptual thing that has can vary in value.
autonomy. Behaviors:
 An object is a cohesive entity consisting of data and the  These are actions performed by the object to fulfil its
operations that act on those data. responsibilities.
 An object is a thing that has an interface that enforces
protection of the encapsulation of its internal structure.

19 20
A radio A digital camera
 Responsibilities:  Responsibilities:
 Allow the user to listen to desired radio frequency Take digital photos
 Attributes:  Attributes:
 Wavelength Available Memory
 Frequency Picture Resolution
 Volume Battery Level
 Behaviors:  Behaviors:
 Tune to a frequency Select Resolution
 Store / Recall a frequency Focus
 Change volume Take Photo
 Switch on / off Upload Photos

21 22

A microwave oven Objects can be …


 Responsibilities?  Software things
Occupy memory at some point in time
 Attributes? For example, CustomerRecord, ECGSample, Window, Font
 Behaviors?  Electronic things
Occupy physical space at some point in time
For example, Thermometer, LCDDisplay, MotionSensor, DCMotor
 Mechanical things
Occupy physical space at some point in time
For example, WingSurface, Gear, Door, HydraulicPress
 Chemical things
Occupy physical space at some point in time
For example, Battery, GasMixture, Halothane
 System things
Occupy physical space at some point in time
For example, PowerSubsystem, RobotArm, Space Shuttle

23 24
Object identity Object views
 All objects are unique even if their attributes are the same  Objects have generally two different
as another. views:
 For example, in this room, there are probably many Public view:
mobile phones, of which several might well be identical.  This is the view that can be seen from
Even if they are identical, they are all unique. outside of the object.
Private view:
 This is the internal only view, access is
controlled and the details are hidden
from the outside world.

Andy’s Ian’s Colin’s


phone phone phone

25 26

Object interface Object attributes


The Public view of an object is the interface that the object exposes  Attributes are typed values holding information known
to the outside world and which other objects can use to communicate to the object, for example:
with it.
value: int
Objects contain their own attributes and generally do not allow other patientName: string
objects to directly manipulate these attributes.
If other Objects need access to the attributes, then the object
provides public operations (known as getters and setters) to  All objects of the same type have the same set of
manipulate these attributes. attributes but different copies (hence they may have
different values).
This allows the freedom to change the type of the attribute without the
clients knowing about it or indeed having to make any changes. All
that is needed is to modify the getter and setter to manipulate the
new attribute type.  Attributes are primitive in structure and behavior:
If they are rich, then they should be themselves objects.
Getters and Setters are
sometimes called Accessors and
Mutators.

27 28
Object operations UML class
 Objects execute operations to implement behavior:  A Class is the definition or specification of an object.
 An object is an instance of a class.
Operations are primitive behaviors such as:
 An object has the attributes and behaviors defined by its class.
 ++x  A class can be shown on a Class Diagram in one of many ways.
 y = sin(x)^2 + cos(x)^2  On some diagrams, you might want to show just the name of the class.
 z = mySensor->getValue()  Sometimes, you might want to show just the operations; other times, you
 Operations can manipulate the attributes, call other might want to show all attributes and all operations.
operations.
 Operations can be invoked from other objects as well as
from a state chart or activity diagram attached to the Attributes

object.
Name

Operations

29 30

UML object Multiplicity


 As with a class, an Object (also known as an Instance)  When showing Objects, you need to indicate how many
can also be shown on a Class/Object Diagram in many objects there are.
ways:
Multiplicity Attribute
 This is done with the Multiplicity, which most of the time is
values at a 1.
specific
instance in
time

Implicit
object

Object name Class name

It is not necessary
to show every
attribute, every
operation, visibility,

31 32
Visibility defined Constructors and destructors
 Attributes and Methods or Operations are features of a class.  Every Class has a couple of special operations allowing
 Features have the visibility adornments: Objects to be constructed / destroyed.
+ public  A constructor is always called when an Object is created
 Accessible by any client of the class. and generally initializes its attributes.
# protected  A destructor is always called when the Object is
 Accessible only from within the same class or subclasses. destroyed and ensures that any allocated resources are
- private properly returned.
 Accessible only from within the same class.

Constructor
Rather than using these
symbols, Rational
Rhapsody uses more
graphical ones which are
easier to understand.
Destructor

33 34

Static and abstract operations Exercise 1


 A static operation is shown underlined.  What are the attributes, operations and responsibilities of
 An abstract operation is shown in italic. the following?

 Solutions will be discussed in the tute session.


35 36
Object discovery strategies Object discovery strategies
 Identify the nouns
 Services to be performed
 Transactions
 Physical devices
 Key concepts
 Persistent data
 Control Element
 Walking through scenarios
 Experience

37 38

Identify the nouns Services to be performed


 Find nouns and noun phrases in the problem statement  Service providers are usually passive servers
 Provides a first-cut list of potential classes and objects  May provide:
 Discovers:
Strategy
Objects of interest
Algorithm
Uninteresting objects
What do I Creation of complex objects
Attributes What do I
know? …
do?
 Examples:
Measurement
Filter
What are my CommandFactory
responsibilities?

39 40
Physical devices Key concepts
 Very common approach in embedded systems.  These are the fundamental abstractions in the domain.
 Devices are often modeled as classes and objects.  These concepts often have no physical manifestation.
 ECG Example:
 Examples:
Heart
A/D converter UI Domain Window, Icon, Cursor, Tool Bar, …
Switch Robotics Task plan
Button Banking Account
OS Thread
Physical devices are modeled either as
interfaces to the actual hardware (actual Navigation Waypoint
behavior is in the hardware, the software class
provides a means for objects to talk to it) or, less
commonly, simulations (simulates actual
hardware behavior).

41 42

Transactions Persistent information


 Transactions are objects arising from the need to  Information that must be stored for later retrieval is either
manage or track the interaction of other objects. objects or attributes.
 Transaction objects may be:  Examples:
Persistent: require long term storage  A medical device must maintain an alarm history for later
Volatile: disappear when the transaction completes reporting
 Waveform data must be maintained for 20s buffer to be routed
 Examples: to a chart recorder
Message  Access passwords and user IDs
Command  Calibration constants

43 44
Control elements Walking through scenarios
 Entities that control other objects  Scenarios consist of objects interacting in specific ways
A specific type of causal agent over time.
 Examples:
Transaction controller in database  Allow testing of class and object models:
Are all necessary facilities and services available?
Audio and video synchronizer
Do the object’s attributes and behaviors support its
Autopilot responsibilities?
Clothes washer cycle controller

A Causal agent is any entity


that produces an effect or is
responsible for events or
results.

45 46

Das könnte Ihnen auch gefallen