UML mdels
UML mdels
Each UML diagram is designed to let developers and customers view a software
system from a different perspective and in varying degrees of abstraction. UML
diagrams commonly created in visual modeling tools include:1
Use Case Diagram displays the relationship among actors and use cases.1
Class Diagram models class structure and contents using design elements such
as classes, packages and objects. It also displays relationships such as
containment, inheritance, associations and others. 1
Interaction Diagrams
Activity Diagram displays a special state diagram where most of the states are
action states and most of the transitions are triggered by completion of the
actions in the source states. This diagram focuses on flows driven by internal
processing.1
Physical Diagrams
1
Deployment Diagram displays the configuration of run-time processing
elements and the software components, processes, and objects that live
on them. Software component instances represent run-time
manifestations of code units.1
Bank ATM Use Cases: An automated teller machine (ATM) or the automatic banking
machine (ABM) is banking subsystem (subject) that provides bank customers with
access to financial transactions in a public space without the need for a cashier, clerk or
bank teller.
Customer (actor) uses bank ATM to check balances of his/her bank accounts, deposit
funds, withdraw cash and/or transfer funds (use cases). ATM Technician provides
maintenance and repairs. All these use cases also involve Bank actor whether it is
related to customer transactions or to the ATM servicing.
Hospital Reception subsystem or module supports some of the many job duties of
hospital receptionist. Receptionist schedules patient's appointments and admission to
the hospital, collects information from patient upon patient's arrival and/or by phone. For
the patient that will stay in the hospital (inpatient) s/he should have a bed allotted in a
ward. Receptionists might also receive patient's payments, record them in a database
and provide receipts, file insurance claims and medical reports.
2
Class Diagrams
Class diagrams are widely used to describe the types of objects in a system and
their relationships. Class diagrams model class structure and contents using
design elements such as classes, packages and objects.2 Class diagrams
describe three different perspectives when designing a system, conceptual,
specification, and implementation.1 These perspectives become evident as the
diagram is created and help solidify the design. Classes are composed of three
things: a name, attributes, and operations. Below is an example of a class.
3
The association relationship is the most common relationship in a class diagram.
The association shows the relationship between instances of classes. For
example, the class Order is associated with the class Customer.
-The multiplicity of the association denotes the number of objects that can
participate in the relationship.1 For example, an Order object can be associated
to only one customer, but a customer can be associated to many orders.
Example:
4
In this example, the classes Corporate Customer and Personal Customer have
some similarities such as name and address, but each class has some of its own
attributes and operations. The class Customer is a general form of both the
Corporate Customer and Personal Customer classes.1 This allows the designers
to just use the Customer class for modules and do not require in-depth
representation of each type of customer.
5
Interaction Diagrams
Interaction diagrams model the behavior of use cases by describing the way
groups of objects interact to complete the task. The two kinds of interaction
diagrams are sequence and collaboration diagrams.
Sequence diagrams:
6
Below is a slightly more complex example. The
light blue vertical rectangles the objects
activation while the vertical dashed lines
represent the life of the object. The green
vertical rectangles represent when a particular
object has control. The represents when the
object is destroyed. This diagrams also shows
conditions for messages to be sent to other
object. The condition is listed between brackets
next to the message. For example, a [condition]
has to be met before the object of class 2 can
send a message() to the object of class 3.
7
The next diagrams adds another conditional
message to the Order object. If the item is
[OutOfStock] it sends a message back to the
Order Entry Window object stating that the
object is out of stack.
Collaboration diagrams:
8
Collaboration diagrams are also relatively easy
to draw. They show the relationship between
objects and the order of messages passed
between them. The objects are listed as icons
and arrows indicate the messages being passed
between them. The numbers next to the
messages are called sequence numbers. As
the name suggests, they show the sequence of
the messages as they are passed between the
objects. There are many acceptable sequence
numbering schemes in UML. A simple 1, 2, 3...
format can be used, as the example below
shows, or for more detailed and complex
diagrams a 1, 1.1 ,1.2, 1.2.1... scheme can be
used.
9
State Diagrams
State diagrams are used to describe the behavior of a system. State diagrams
describe all of the possible states of an object as events occur. Each diagram
usually represents objects of a single class and track the different states of its
objects through the system.
All state diagrams being with an initial state of the object. This is
the state of the object when it is created. After the initial state
the object begins changing states. Conditions based on the
activities can determine what the next state the object transitions
to.
10
Below is an example of a state diagram might look like for an
Order object. When the object enters the Checking state it
performs the activity "check items." After the activity is
completed the object transitions to the next state based on the
conditions [all items available] or [an item is not available]. If an
item is not available the order is canceled. If all items are
available then the order is dispatched. When the object
transitions to the Dispatching state the activity "initiate delivery"
is performed. After this activity is complete the object transitions
again to the Delivered state.
11
redundant state. This helps make the state diagram easier to
read.
Activity Diagrams
12
However, activity diagrams should not take the place of
interaction diagrams and state diagrams. Activity diagrams do
not give detail about how objects behave or how objects
collaborate. 1
activities
13
Below is a possible activity diagram for processing an order.
14
1
Physical Diagrams
There are two types of physical diagrams: deployment diagrams and component
diagrams. Deployment diagrams show the physical relationship between hardware and
software in a system. Component diagrams show the software components of a system
and how they are related to each other. These relationships are called dependencies. 1
15
and component diagram combines the features of both diagrams
into one diagram.
16
Summary
17
18