Unit 5 UML State Diagrams and Modeling
Unit 5 UML State Diagrams and Modeling
Operation Contracts
We have described:
Use Cases
Domain Model
System Sequence Diagrams
We now describe
Operation Contracts
spec:=getSpec(id)
enterItem(id,qty) spec:=find(id)
There are two types of nodes in a deployment diagram: device nodes and
execution environment nodes. Device nodes are computing resources with
processing capabilities and the ability to execute programs. Some examples
of device nodes include PCs, laptops, and mobile phones.
An execution environment node, or EEN, is any computer system that resides
within a device node. It could be an operating system, a JVM, or another
servlet container.
Database
Diagramming is quick and easy with Lucidchart. Start a free trial today to
start creating and collaborating.
Create a UML Diagram
Component diagram shapes and symbols
Component diagrams range from simple and high level to detailed and
complex. Either way, you'll want to familiarize yourself with the appropriate
UML symbols. The following are shape types that you will commonly
encounter when reading and building component diagrams:
How to use component shapes and symbols
Provided interfaces: A
straight line from the
component box with an
attached circle. These
symbols represent the
interfaces where a
component produces
information used by the
required interface of another
component.
Required interfaces: A
straight line from the
component box with an
attached half circle (also
represented as a dashed
arrow with an open arrow).
These symbols represent the
interfaces where a
component requires
information in order to
perform its proper function.
In UML, a component diagram visually represents how the components of a
software system relate to one another. To build one, try using Lucidchart’s
custom component diagram shape library. Component diagrams should
communicate:
• The scope of your system
• The overall structure of your software system
• Goals that the system helps human or non-human entities (known as actors)
achieve
Component diagram examples
UML component diagrams bring simplicity to even the most complex
processes. Take a look at the examples below to see how you can map the
behaviors of specific processes with component diagrams in UML.
Component diagram for a library management system
Library systems were some of the first systems in the world to become
widely run by computers. Today, many of these systems are managed in the
cloud by third-party services, rather than internally. Though the term “library
system” typically calls to mind a way to monitor printed books, library
systems today organize all kinds of data checked in and checked out by users.
These transactions create a network of relationships between the
components of the library system. To understand how these relationships
work and how the system functions overall, examine the UML diagram
below. You or your team can also use this diagram as a template.
Click here to use this template
Component diagram for an ATM system
A component diagram is similar to a class diagram in that it illustrates how
items in a given system relate to each other, but component diagrams
show more complex and varied connections that most class diagrams can.
In the diagram below, each component is enclosed in a small box. The dotted
lines with arrows show how some components are dependent on others. For
example, the card reader, web page, client desktop, and ATM system are all
dependent on the bank database. The dotted lines with circles at the end,
known as “lollipop” symbols, indicate a realization relationship.
How to make a component diagram
In Lucidchart, you can easily craft an intricate component diagram in UML
from scratch. Just follow the steps below:
1. Open a blank document or start with a template.
2. Enable the UML shape library. Click "Shapes" on the left side of the editor,
check "UML" in the Shape Library Manager, and click "Save."
3. Select the shape you want from the library you added, and drag the shape
from the toolbox to the canvas.
4. Model the process flow by drawing lines between shapes.
What is a state diagram in UML?
A state machine is any device that stores the status of an object at a given
time and can change status or cause other actions based on the input it
receives. States refer to the different combinations of information that an
object can hold, not how the object behaves. In order to understand the
different states of an object, you might want to visualize all of the possible
states and show how an object gets to each state, and you can do so with a
UML state diagram.
Each state diagram typically begins with a dark circle that indicates the initial
state and ends with a bordered circle that denotes the final state. However,
despite having clear start and end points, state diagrams are not necessarily
the best tool for capturing an overall progression of events. Rather,
they illustrate specific kinds of behavior—in particular, shifts from one state
to another.
State diagrams mainly depict states and transitions. States are represented
with rectangles with rounded corners that are labeled with the name of the
state. Transitions are marked with arrows that flow from one state to
another, showing how the states change. Below, you can see both these
elements at work in a basic diagram for student life. Our UML diagram
tool can help you design any custom state machine diagram.
State diagram applications
Like most UML diagrams, state diagrams have several uses. The main
applications are as follows:
• Depicting event-driven objects in a reactive system.
• Illustrating use case scenarios in a business context.
• Describing how an object moves through various states within its lifetime.
• Showing the overall behavior of a state machine or the behavior of a related
set of state machines.
Diagramming is quick and easy with Lucidchart. Start a free trial today to
start creating and collaborating.
Create a UML Diagram
State diagram symbols and components
You can include many different shapes in a state diagram, particularly if you
choose to combine it with another diagram. This list summarizes the most
common shapes you may encounter.
Composite state
A state that has substates nested into it. See the university state
diagram example below. “Enrollment” is the composite state in this example
because it encompasses various substates in the enrollment process.
Choice pseudostate
A diamond symbol that indicates a dynamic condition with branched
potential results.
Event
An instance that triggers a transition, labeled above the applicable transition
arrow. In this case, “classes end” is the event that triggers the end of the
“Being taught” state and the beginning of the “Final exams” state.
Exit point
The point at which an object escapes the composite state or state machine,
denoted by a circle with an X through it. The exit point is typically used if the
process is not completed but has to be escaped for some error or other
issue.
First state
A marker for the first state in the process, shown by a dark circle with a
transition arrow.
Guard
A Boolean condition that allows or stops a transition, written above the
transition arrow.
State
A rectangle with rounded corners that indicates the current nature of an
object.
Substate
A state contained within a composite state's region. In the university state
machine diagram found below, “Open for enrollment” is a substate in the
larger “Enrollment” composite state.
Terminator
A circle with a dot in it that indicates that a process is terminated.
Transition
An arrow running from one state to another that indicates a changing state.
Transitional behavior
A behavior that results when a state transitions, written above the transition
arrow.
Trigger
A type of message that actively moves an object from state to state, written
above the transition arrow. In this example, “Issue with reservation” is the
trigger that would send the person to the airport travel agency instead of the
next step in the process.
State diagram examples
Calendar availability state diagram example
This state machine diagram example shows the process by which a person
sets an appointment on their calendar. In the “Check date” composite state,
the system checks the calendar for availability in a few different substates. If
the time is not available on the calendar, the process will be escaped. If the
calendar shows availability, however, the appointment will be added to the
calendar.
University state diagram example
This state diagram shows the process of enrollment and classes at a
university. The composite state “Enrollment” is made up of various substates
that will lead students through the enrollment process. Once the student has
enrolled, they will proceed to “Being taught” and finally to “Final exams.”
Airport check-in state diagram example
The following example simplifies the steps required to check in at an airport.
For airlines, a state diagram can help to streamline processes and eliminate
unnecessary steps.