Title: Unified Modeling Language
1Unified Modeling Language
- A common vocabulary for talking about software
design
2Models
- One of the most important steps in OO problem
solving is the construction of a model. - The model abstracts the essential details of the
underlying problem from its usually complicated
real world. - The domain is the actual world from which the
problem comes. - Models consist of objects interacting by sending
messages.
3The Importance Of UML
- UML provides tools for modeling problems in order
to create software. - UML provides a common vocabulary to the
participants in the problem solving (whether a
business analyst, designer, or programmer).
4UML Breakdown
- UML actually consists of several tools
- Use case diagrams
- Class diagrams
- Object diagrams
- Sequence diagrams
- Collaboration diagrams
- Statechart diagrams
- Activity diagrams
- Component diagrams
- Deployment diagrams
5Use Case Diagrams
- Use case diagrams depict the system from an
external observers perspective. - They describe what the system does rather than
how. - A scenario describes what happens when someone
interacts with the system. - Example scenario A patient calls the clinic to
make an appointment for a yearly checkup. The
receptionist finds the nearest empty time slot in
the appointment book and schedules the
appointment for that time slot. - A use case is a summary of scenarios for a single
task.
6Use Case Diagrams
- Use case diagrams consist of
- Actors
- Use cases
- Communications
- An actor is who or what initiates the events in a
task. - A communication association (or simply a
communication) is a connection between actors and
use cases.
7Example Use Case Diagram
Figure 1 Simple use case diagram
Figure 2 More complicated use case diagram
8Use Case Diagrams
- Use case diagrams are helpful in
- determining features new use cases generate new
requirements - communicating with clients simple notation can
be understood by non-technical people - generating test cases the scenarios suggest
tests that can verify correct behavior
9Class Diagrams
- Class diagrams show the classes in the system and
their relationships. - Class diagrams are staticthey display who
interacts but not how they interact. - A class in UML is shown as a rectangle divided
into three parts class name, attributes, and
operations.
10Class Diagrams
Customer
class name
name address
attributes
getName
operations
11Example Class Diagram
Figure 3 Customer order example
12Class Diagrams
- Class diagrams can describe the following
relationships - association an association exists between two
classes if an instance of one class must know
about the other to perform its work. - aggregation an association in which one class
belongs to a collection. - generalization inheritance
13Associations
- An association has two ends. One end may have a
role name to clarify the relationship. - A navigability arrow on an association shows the
direction the association can be traversed. - Multiplicity of an association end is the number
of possible instances of the class associated
with a single instance of the other end.
14Common Multiplicities
Multiplicities Meaning
0..1 zero or one instance
0.. or no limit on the number of instances (including none)
1 exactly one instance
1.. at least one instance
15Composition Aggregation
- Associations in which an object is part of a
whole are aggregations. - Composition is a strong association in which the
part can belong to only one wholethe part cannot
exist without the whole. - Composition is denoted by a filled diamond at the
whole end.
16Example Composition
Figure 4 Composition example
17Visibility
- Visibility (private, public, protected) can also
be shown in class diagrams. - Static members are underlined.
- Operations have the form
- ltaccess specifiergt ltnamegt ( ltparameter listgt)
ltreturn typegt - The parameter list shows each parameter type
preceded by a colon.
18Visibility
Symbol Access
public
- private
protected
19Example Visibility
Figure 5 Visibility example
20Interfaces
- Interfaces can be shown in two ways
- shown similar to regular classes
- shown as lollipops or circles shows less
detail - Both notations use the inheritance arrow.
21Example Interface (1st notation)
Figure 6 Interfaces
22Example Interface (2nd notation)
Figure 7 Lollipop notation
23Object Diagrams
- Object diagrams show instances instead of
classes. They are especially useful in
describing recursive relationships. - Each rectangle in the diagram corresponds to a
single instance. - Rectangles are labeled instanceNameclassName.
24Example Object Diagram
Figure 8 Class diagram
Figure 9 Object diagram (instantiation of above
class diagram)
25Interaction Diagram
- Interaction diagrams are dynamicthey describe
how objects collaborate. - There are two kinds of interaction diagrams
- sequence diagrams
- collaboration diagrams
26Sequence Diagrams
- A sequence diagrams shows what messages are sent
to whom and when. - They are organized according to time.
- Time progresses down the page.
- Objects are displayed left to right as they
become relevant.
27Example Sequence Diagram
Figure 10 Making a hotel reservation
28Sequence Diagrams
- Each vertical dotted line is a lifeline
representing the time the object exists. - Each arrow is a message call.
- The arrows go from the sender to the top of the
activation bar of the receiver. - Activation bars represent the duration of the
message. - All UML diagrams can contain notes dog-eared
rectangles containing clarifying text. - Conditions are in square brackets.
29Collaboration Diagrams
- Collaboration diagrams focus on object roles
rather than times that messages are sent. - Each message in a collaboration diagram has a
seqence number. The top-level message is
numbered 1. - Messages at the same level (sent during the same
call) have the same prefix but with consecutive
suffixes according to when they occur.
30Example Collaboration Diagram
Figure 11 Collaboration diagram for hotel
reservation
31Statechart Diagrams
- A statechart diagram depicts the possible states
an object can be in and the transitions that
change states. - States are rounded rectangles.
- Transitions are arrows.
- Events or conditions that trigger transitions are
written beside the arrows. - Initial state is solid black circle.
- Final states are concentric white/black circles.
32Example Statechart Diagram
Figure 12 Online banking login
33Statechart Diagrams
- An action that occurs as a result of an event or
condition is expressed as /action. - Actions can occur inside states too. The enter,
do, and exit events on a state trigger actions
when the state is entered, once inside, and
exited respectively.
34Activity Diagrams
- Activity diagrams are fancy flowcharts.
- Activity diagrams focus on the flow of activities
involved in a single process. - Activities are rounded rectangles.
35Example Activity Diagram
Figure 13 Withdrawing money from a bank account
through an ATM
36Activity Diagrams
- Swimlanes divide activities according to who
performs them. - A transition may branch into two or more mutually
exclusive transitions. - Guard expressions label transitions leaving a
branch. - A merge brings together multiple transitions
(those created in the branch). - A fork denotes parallel execution.
- A join is where parallel execution meets up.
(One waits on another to complete before
continuing).
37Component And Deployment Diagrams
- A component is a code module.
- Components are shown as rectangles with two tabs
at upper left. - Deployment diagrams show the physical
configurations of software and hardware. - Physical hardware is made up of nodes.
- Each components belongs on a node.
38Example Deployment Diagram
Figure 14 Real estate transactions
39UML Tools
- Software exists for UML creation.
- Some software can synchronize UML diagrams and
code. - Some software can generate code once UML diagram
is completed. - Rational Rose is currently the most popular
software for UML creation.
40Works Cited
- Practical UML A Hands-On Introduction for
Developers. http//www.togethersoft.com/services/
practical_guides/umlonlinecourse/