UML Diagrams for System Design
UML Diagrams for System Design
Problem Statement: Identify Use Cases and develop the Use Case Diagram for Hydroponics
Gardening System.
Procedure:
A use case diagram is a graphical representation of a user's possible interactions with a system. A
use case diagram shows various use cases and different types of users and the system. The use
cases are represented by either circles or ellipses.
System
Use Case
Draw use cases using ovals. Label the ovals with verbs that represent the
systems functions
Actor
Actors or users are the entities that interact with the system. Actors represent the role the user
play with the system.
Relationships
1
b) Generalization: A generalization relationship is used to represent inheritance
relationship between model elements of same type.
c) <<include>> This is a relationship in which one use case (the base use case) includes
the functionality of another use case (the inclusion use case). The include relationship
supports the reuse of functionality in a use-case model.
d) <<extend>>Extend relationship to specify that one use case (extension) extends the
behavior of another use case (base). This type of relationship reveals details about a
system or application that are typically hidden in a use case.
2
Output
3
Exercise Use case Diagram to return a book with fine in Library
2 Management System
Problem Statement: Demonstrate a use case for returning book with fine for library system.
Procedure:
A use case diagram is a graphical representation of a user's possible interactions with a system. A
use case diagram shows various use cases and different types of users and the sytem. The use
cases are represented by either circles or ellipses.
System
Use Case
Draw use cases using ovals. Label the ovals with verbs that represent the
systems functions
Actor
Actors or users are the entities that interact with the system. Actors represent the role
the user play with the system.
Relationships
4
b) Generalization: A generalization relationship is used to represent inheritance
relationship between model elements of same type.
c) <<include>> This is a relationship in which one use case (the base use case) includes
the functionality of another use case (the inclusion use case). The include relationship
supports the reuse of functionality in a use-case model.
d) <<extend>>Extend relationship to specify that one use case (extension) extends the
behavior of another use case (base). This type of relationship reveals details about a
system or application that are typically hidden in a use case.
5
Output
6
Exercise
Class Diagram for the Environmental Control System
3
Problem Statement: Demonstrate Class Diagram for the Environmental Control System
Procedure:
Class Diagram
Class diagrams are fundamental to the object modeling process and model the static structure of
a system. These are the blueprints of your system or subsystem.
Class Visibility
The +, - and # symbols before an attribute and operation name in a class denote the visibility of
the attribute and operation.
7
+ denotes public attributes or operations
- denotes private attributes or operations
# denotes protected attributes or operations
Associations
Associations represent static relationships between classes. Place association names above on or
below the association line. Use a filled arrow to indicate the direction of relationship. Place
roles near the end of an association. Roles represent the way the two classes see each other.
Aggregation: Implies IS-A relationship that where the child can exist independently of
the parent. Example: Class (parent) and Student (child). Delete the Class and the Students
still exist.
Composition: Implies HAS- A relationship where the child cannot exist independent of
the parent. Example: House (parent) and Room (child). Rooms don't exist separate to a
House.
8
Generalization
Generalization is a mechanism for combining similar classes of objects into a single, more
general class. Generalization identifies common among a set of entities. The commonness may
be of attributes, behavior, or both. In other words, a superclass has the most general attributes,
operations, and relationships that may be shared with subclasses.
Specialization: is the reverse process of Generalization means creating new sub-classes from an
existing class.
9
Output
10
Exercise
Object Diagram for the Library Management System
4
Problem Description: Demonstrate Object Diagram for the library management system.
Procedure
Object Diagram:
Object Name: Every object is actually symbolized like a rectangle, that offers the name from the
object and its class underlined as well as divided with a colon.
Object Attributes:
Similar to classes, we can list object attributes inside a separate compartment. However,
unlike classes, object attributes should have values assigned for them.
Links:
11
Dependency Relationship
A dependency relationship is a relationship in which one element, the client, uses or depends on
another element.
Type of Keyword or
dependency Stereotype Description
Abstraction «abstraction», Relates two model elements, or sets of model elements,
«derive», «refine», or that represent the same concept at different levels of
«trace» abstraction, or from different viewpoints
Binding «bind» Connects template arguments to template parameters to
create model elements from templates
Realization «realize» Indicates that the client model element is an
implementation of the supplier model element, and the
supplier model element is the specification
Substitution «substitute» Indicates that the client model element takes the place of
the supplier; the client model element must conform to
the contract or interface that the supplier model element
establishes
Usage «use», «call», Indicates that one model element requires another model
«create», element for its full implementation or operation
«instantiate», or
«send»
12
Deploy Relationships
13
Output
14
Exercise
Activity Diagram for Hydrophonics Gardening System
5
Procedure:
Activity Diagram: Activity diagram provides a view of the behavior of a system by describing
the sequence of actions in a process. Activity diagrams are similar to flowcharts because they
show the flow between the actions in an activity.
In activity diagrams, you use activity nodes and activity edges to model the flow of control and
data between actions.
A small filled circle followed by an arrow represents the initial action state or the start point for
any activity diagram. For activity diagram using swim lanes, make sure the start point is placed
inthe top left corner of the first column.
An action state represents the non-interruptible action of objects. You can draw an action state in
using a rectangle with rounded corners.
Action Flow
Action flows, also called edges and paths, illustrate the transitions from one action state to
another. They are usually drawn with an arrowed line.
15
Object Flow
Object flow refers to the creation and modification of objects by activities. An object flow arrow
from an action to an object means that the action creates or influences the object. An object flow
arrow from an object to an action indicates that the action state uses the object.
Synchronization
16
Time Event
This refers to an event that stops the flow for a time; an hourglass depicts it.
Merge Event
A merge event brings together multiple flows that are not concurrent.
An arrow pointing to a filled circle nested inside another circle represents the final action state.
17
Output
18
Exercise
Sequence Diagram for Environment Control System
6
Procedure:
Messages – Communication between objects is depicted using messages. The messages appear
in a sequential order on the lifeline. We represent messages using arrows. These messages are
classified into two types
a) Synchronous Message: A
synchronous message waits for a
reply before the interaction can
move forward. The sender waits
until the receiver has completed
the processing of the message.
19
b) Asynchronous Message: An
asynchronous message does not wait for
a reply from the receiver. The
interaction moves forward irrespective
of the receiver processing the previous
message or not.
Create message – We use a Create message to instantiate a new object in the sequence diagram..
Delete Message – We use a Delete Message to delete an object. When an object is deallocated
memory or is destroyed within the system we use the Delete Message symbol. It destroys the
occurrence of the object in the system
20
Self Message – Certain scenarios might arise where the object needs to send a message to itself.
21
Output
22
Exercise Sequence Diagram for Return and Remove Books in
7 Library Management System
Procedure:
Messages – Communication between objects is depicted using messages. The messages appear
in a sequential order on the lifeline. We represent messages using arrows. These messages are
classified into two types
a) Synchronous Message: A
synchronous message waits for a
reply before the interaction can
move forward. The sender waits
until the receiver has completed
the processing of the message.
23
b) Asynchronous Message: An
asynchronous message does not wait for
a reply from the receiver. The
interaction moves forward irrespective
of the receiver processing the previous
message or not.
Create message – We use a Create message to instantiate a new object in the sequence diagram..
Delete Message – We use a Delete Message to delete an object. When an object is deallocated
memory or is destroyed within the system we use the Delete Message symbol. It destroys the
occurrence of the object in the system
24
Self Message – Certain scenarios might arise where the object needs to send a message to itself.
25
Output
26
Exercise
Communication Diagram for Hydrophonics Gardening System
8
Problem Description: Draw the communication Diagram for the Hydrophonics Gardening
System
Procedure:
Communication Diagram
A communication diagram is a type of UML interaction diagram that illustrates the flow of
messages between the objects in an interaction. You can add and modify lifelines, message
pathways, and messages in communication diagrams
Communication diagrams are a type of interaction diagram that you can use to explore
the dynamic behavior of a system or software application.
They provide an alternate view of the same information as sequence diagrams
In sequence diagrams, the focus is the ordering of the messages over time;
In communication diagrams the focus is the structure of the messages that pass between
the objects in the interaction
These diagrams illustrate the flow of messages between objects and the implied
relationships between classes.
We can use communications diagrams to explore how objects in a system or application work
together. Communication diagrams can identify the following aspects of an interaction or task:
Interaction frames
In sequence diagrams and communication diagrams,
an interaction frame provides a context or boundary to
the diagram in which you create diagram elements,
such as lifelines or messages, and in which you
observe behavior.
27
The frame and its contents represent an interaction in a sequence diagram or communication
diagram. The heading label of the interaction frame is the name of the interaction that the
diagram represents. In sequence diagrams, a frame can represent combined fragments, which
represent scenario constructs, and interaction uses, which represent an interaction within an
interaction.
. Messages – Communication between objects is depicted using messages. The messages appear
in a sequential order on the lifeline. We represent messages using arrows. These messages are
classified into two types
a) Synchronous Message: A
synchronous message waits for a
reply before the interaction can
move forward. The sender waits
until the receiver has completed
the processing of the message.
b) Asynchronous Message: An
asynchronous message does not
wait for a reply from the receiver. The
interaction moves forward irrespective
of the receiver processing the previous
message or not.
28
Create message – We use a Create message to instantiate a new object in the sequence diagram..
Delete Message – We use a Delete Message to delete an object. When an object is deallocated
memory or is destroyed within the system we use the Delete Message symbol. It destroys the
occurrence of the object in the system
29
Self Message – Certain scenarios might arise where the object needs to send a message to itself.
Reply Message – Reply messages are used to show the message being sent from the receiver to
the sender.
Found Message – A Found message is used to represent a scenario where an unknown source
sends the message
30
Output
31
Exercise
Interaction Diagram for Library Management System
9
Problem Description: Draw the Interaction Diagram for Library Management System
Procedure:
An interaction overview diagram is a form of activity diagram in which the nodes represent
interaction diagrams. Interaction diagrams can include sequence, communication, interaction
overview and timing diagrams. Most of the notation for interaction overview diagrams is the
same for activity diagrams. For example, initial, final, decision, merge, fork and join nodes are
all the same. However, interaction overview diagrams introduce two new elements: interaction
occurrences and interaction elements.
Interaction occurrence
Interaction element
Initial
32
Note
Used to include notes for other users that can’t be communicated within the diagram itself.
Activity/Action
Decision or Merge/Branch
A diamond symbol used when there are at least two alternate paths for the user to choose from.
Action/Control Flow
33
Fork/Join
Used to split one activity flow into two or more concurrent activities.
Used to join multiple concurrent activities into one or multiple outgoing flows.
Flow final
The end of a specific process flow, but not the end of all activity.
End
34
Output
35
Exercise Composite Structure Diagram for Water Tank
10 (Hydrophonics Gardening System)
Problem Description: Draw the Composite Structure Diagram for Hydrophonics Gardening
Systems Water Tank.
Procedure:
Composite Structure Diagrams show the internal parts of a class. Parts are named:
partName:partType[multiplicity]. Aggregated classes are parts of a class but parts are not
necessarily classes, a part is any element that is used to make up the containing class.
36
Actor
A Composite Structure Diagram shows Actors as top-level items using the following notation.
Association
You can add Associations (typically called connectors on a Composite Structure Diagram)
between Classes, Data Types, Interfaces, Signals, Parts, Ports and Actors on a Composite
Structure Diagram. When you create an Association on a Composite Structure Diagram, the
Association is created between each item in the context of its containing items.
Class
A Composite Structure Diagram shows Classes as top-level items using the following notation.
The main compartment of a Class can contain Parts and its boundary can include Ports.
Data Type
A Composite Structure Diagram shows Classes as top-level items using the following notation.
The main compartment of a Data Type can contain Parts and its boundary can include Ports.
You can add Dependencies between Classes, Data Types, Interfaces, Signals, Parts and Ports on
a Composite Structure Diagram.
Interface
A Composite Structure Diagram shows Interfaces as top-level items using the following
notation.
The main compartment of a Data Type can contain Parts and its boundary can include Ports.
In addition, Interfaces can be shown as provided Interface Classes (lollipops) and required
Interface Classes (cups) that are dependent on Classes, Data Types, Interfaces and Signals, Parts
and Ports.
37
IO Flow
A Composite Structure Diagram can show an IO Flow as an IO Flow Link between items using
the following notation.
When an IO Flow is realized by an Association, a Composite Structure Diagram can show the IO
Flow on the Association using the following notation.
Part
A Part is a Role or an Attribute with a Basic Type, Class, Data Type, Interface, Signal or Type
Definition set as its data type) in the context of a top-level Class, Data Type, Interface or Signal,
and its contained Parts and Ports.
A Part appears on a Composite Structure Diagram as a box or a box with a compartment.
Non-composite Parts have a dashed outline. A Part has a compartment when it shows contained
Parts or Ports.
Port
A Port is an aggregate Role or Attribute (with a Basic Type,
Class, Data Type, Interface, Signal or Type Definition set as
its data type) set up as a Port in the context of a top-level
Class,
Data Type, Interface or Signal, and its contained Parts and
Ports.
An aggregate Role or Attribute is set up as a Port by
selecting the Port check box on its Property Pages.
38
A Port appears on a Composite Structure Diagram as a box on the boundary of a Class, Signal,
Part or Port. Non-composite Parts have a dashed outline.
Signal
A Composite Structure Diagram shows Signals as top-level items using the following notation.
39
Output
40
Exercise Timing Diagram for the value object to fill the
11 Water Storage Tank
Problem: Draw the Timing Diagram for a value object that is controlled to fill the Water Storage
Tank object in Hydro phonics Gardening System.
Procedure
Timing diagrams are used to display the change in state or value of one or more elements over
time. A state lifeline shows the change of state of an item over time. The X-axis displays
elapsed time in whatever units are chosen. The Y-axis is label with a given list of states.
Lifeline
Timing diagram could show states of the participating classifier or attribute, or some testable
conditions, such as a discrete or enumerable value of an attribute.
41
Duration Constraint
Duration constraint is an interval constraint that refers to a duration interval. The duration
interval is duration used to determine whether the constraint is satisfied.
Duration constraint is shown as some graphical association between a duration interval and the
constructs that it constrains.
Time Constraint
Time constraint is an interval constraint that refers to a time interval. The time interval is time
expression used to determine whether the constraint is satisfied.
Time constraint is shown as graphical association between a time interval and the construct that
it constrains. Typically this graphical association is a small line, e.g., between an occurrence
specification and a time interval.
Destruction Occurrence
The destruction event is depicted by a cross in the form of an X at the end of a timeline.
42
Output
43
Exercise
State Machine Diagram for the Duration Timer
12
Problem Description: Draw the State Machine Diagram for the Duration Timer.
Procedure:
A state diagram shows the behavior of classes in response to external stimuli. Specifically a state
diagram describes the behavior of a single object in response to a series of events in a system.
Sometimes it's also known as a Harel state chart or a state machine diagram. This UML diagram
models the dynamic flow of control from state to state of a particular object within a system
States
States represent situations during the life of an object. You can easily illustrate a state in
SmartDraw by using a rectangle with rounded corners.
Transition
A solid arrow represents the path between different states of an object. Label the transition with
the event that triggered it and the action that results from it. A state can have a transition that
points back to itself.
44
Initial State
A filled circle followed by an arrow represents the object's initial state.
Final State
An arrow pointing to a filled circle nested inside another circle represents the object's final state.
Decision
Constraint is an extension mechanism that enables you to refine the semantics of a UML model
element.
45
Synchronization and Splitting of Control
A short heavy bar with two transitions entering it represents a synchronization of control. The
first bar is often called a fork where a single transition splits into concurrent multiple transitions.
The second bar is called a join, where the concurrent transitions reduce back to one.
46
Output
47
Exercise
Component Diagram for Environment Control System
13
Problem Description: Demonstrate Component Diagram for the Environment Control System
Procedure
Component Diagrams
Component diagrams are used to visualize the organization of system components and the
dependency relationships between them. They provide a high-level view of the components
within a system.
We have explained below the common component diagram notations that are used to draw a
component diagram.
Component
48
3) Rectangle with the component icon and the component
stereotype.
Interfaces in component diagrams show how components are wired together and interact with
each other. The assembly connector allows linking the component’s required interface
(represented with a semi-circle and a solid line) with the provided interface (represented with a
circle and solid line) of another component. This shows that one component is providing the
service that the other is requiring.
Port
49
Dependencies
Although you can show more detail about the relationship between two components using the
ball-and-socket notation (provided interface and required interface), you can just as well use a
dependency arrow to show the relationship between two components.
50
Output
51
Exercise
Package Diagram for Hydrophonics Gardening System
14
Procedure
Package Diagram
Packages group related model elements of all types, including other packages. Packages also
represent namespaces, which means that the model elements within a package must have unique
names.
You can use packages in several diagrams, including class, component, and use-case diagrams.
Each package has a unique name that describes its content.
Package
A package is displayed as a rectangle with a tab in the upper-left corner. The rectangle contains
the name of the package and the package icon.
52
Members of Package outside the package
Visibility of Package
Element Import
53
Package Import
Package Merge
54
Model : Model is a package which captures a view of a system.
Model is notated using the ordinary package symbol (a folder icon)
with a small triangle in the upper right corner of the large rectangle.
55
Output
56
Exercise
Deployment Diagram for Environmental Control System
15
Procedure
Deployment Diagram
Deployment Diagram is a type of diagram that specifies the physical hardware on which the
software system will execute. It also determines how the software is deployed on the underlying
hardware. It maps software pieces of a system to the device that are going to execute it.
The deployment diagram maps the software architecture created in design to the physical system
architecture that executes it. In distributed systems, it models the distribution of the software
across the physical nodes.
Communication Association : This is represented by a solid line between two nodes. It shows
the path of communication between nodes.
57
Devices A device is a node that is used to represent
a physical computational resource in a system. An
example of a device is an application server.
Interface
Stereotype: People use this to depict a device that’s contained within the node. To define
a stereotype, put the name into double arrow brackets. For example, the stereotype for
Java Machine is <<Java Machine>>.
Association: An association is a line that indicates the type of communication that exists
between nodes.
Dependency: This shows which node or component depends on other nodes or
components. To define a dependency, use a broken or dashed line that ends with an
arrow.
58
Output
59