Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Chapter 2 - UML

Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

Software Engineering

Instructor: Mohammed Oumer[M.Sc.]


momoumer2014@gmail.com
Samara University
Chapter Two: UML
This Chapter Covers:
 An overview of UML (Unified Modeling Language))
 Diagrams in the UML
 Use case diagrams
 Class diagrams
 Sequence diagrams
 Activity diagrams
An Overview of UML
 UML is a general purpose notation (symbols) that issued
(expressed) to :-
 Visualize – visible, viewable.
Specify – identify clearly.
 Construct (build) and set up
 Document the artifacts (tool (simple object)) of a
software systems.
 UML was created by the Object Management Group
(OMG) in January 1997.

 UML is a graphical (pictured) language with a set of rules


and semantics (study of meanings in languages).
Cont.
 UML diagrams are not only made for developers but also
for business users, common people, and anybody interested
to understand the system.

 Why we use UML?


Use graphical notation (symbols): more clearly than
natural language (spoken language).
Simplifies the complex process of software design.
Help acquire (obtain) an overall view of a system.
UML is not dependent on any one language or
technology.
Cont.
The UML define the following diagrams:

 Use case diagram


 Class diagram
 Sequence diagram
 State chart diagram
 Activity diagram
 Component diagram
 Deployment diagram
Use case Diagram
A use-case diagram is a set of use cases.
Used for describing a set of user scenarios (description of
possible action or event).
Mainly used for capturing user requirements.
Use Case Diagram (core (key) components)
 Actors: A role that a user plays with respect to a
system, including human and other systems. e.g.
inanimate physical objects (e.g. robot).
Use case: A set of scenarios that describing an
interaction between a user and a system.
Cont.
System boundary: rectangle diagram representing the
boundary (border) between the actors and the system.

Association: communication between an actor and a


use case; represented by a solid line.

Generalization: relationship between one general use


case and a special use case (used for defining special
alternatives).
Cont.
Include: a dotted line labeled <<include>> beginning at
base use case and ending with an arrows pointing to the
include use case.

The include relationship occurs when a chunk of (portion)


behavior is similar across more than one use case.

Use “include” in stead of copying (duplicate) the


description of that behavior.
Cont.
Extend: a dotted line labeled <<extend>> with an arrow
toward the base case.

The extending use case may add behavior to the base use
case. The base class declares “extension points”.
Cont.
Class Diagram
Provide a conceptual model of the system in terms of
entities and their relationships.

Detailed class diagrams are used for developers.

Each class is represented by a rectangle subdivided into


three compartments (sections).

 Name

 Attributes

 Operations
Class Representation
Modifiers are used to indicate visibility of attributes and
operations.
 ‘+’ is used to denote Public visibility (everyone).
 ‘#’ (hash-sign) is used to denote Protected visibility
(friends and derived).
 ‘-’ (hyphen-sign) is used to denote Private visibility
(no one).
By default, attributes are hidden and operations are visible.
There are two kinds of relationships (OO
OO Relationships
Relationships)

 Generalization (parent-child relationship).

 Association ( e.g., student enrolls in course).


OO Relationships: Generalization

 Generalization expresses a parent/child


relationship among related classes.
OO Relationships: Association
Represent relationship between instances of classes
 Student enrolls in a course.
 Courses have students.
 Courses have exams.

An aggregation relationship shows a classifier (division) as


a part of or subordinate to another classifier.
Association has multiplicity and navigability.
 Role names (e.g. enrolls).
 Multiplicity (e.g. One course can have many students).
 Navigability (unidirectional, bidirectional).
Association: Multiplicity and Roles

Role

Multiplicity Role
Symbol Meaning
“A given university groups many people;
1 One and only one some act as students, others as teachers.
0..1 Zero or one A given student belongs to a single
* From zero to any positive integer university; a given teacher may or may
not be working for the university at a
0..* From zero to any positive integer
particular time.”
1..* From one to any positive integer
Class Diagram – Order System
Sequencee Diagram
Sequenc
Sequence diagrams – Models interaction of objects
arranged in time sequence.
X-axis is objects – Object that initiates interaction is left
most – Object to the right are increasingly more
subordinate.
Y-axis is time – Messages sent and received are ordered by
time.
Object life lines represent the existence over a period of
time.
Activation (double line) is the execution of the procedure.
Cont.
State Diagram
Shows the sequence of states that an object goes through
during it’s life.

The state is the set of values that describes an object at a


specific point in time.

The state diagram has five basic elements:

The initial starting point, which is drawn using a solid


circle.

A transition between states, which is drawn using a line


with an open arrowhead.
Cont.
A state, which is drawn using a rectangle with rounded
corners.

A decision point, which is drawn as an open circle.


 One or more termination points, which are drawn
using a circle with a solid circle inside it.
State Diagram for Money W/D from ATM
Activity Diagram
Flow charts that are used to show the workflow of a system
(activity).

They show that:-

 The flow of control from activity to activity in the


system.

 What activities can be done in parallel (side by side).

 Alternate paths through the flow.

 Describe the sequence from one activity to another.


Activity Diagram
Basic components of an activity diagram:-
 Action : A step in the activity wherein the users or
software perform a given task. Actions are symbolized
with rounded edged rectangle.
 Decision node : A conditional branch in the flow that is
represented by a diamond. It includes a single input and
two or more outputs.
 Control flow : Another name for the connectors that
show between steps in the diagram.
 Start node : Symbolizes the beginning of the activity.
The start node is represented by a black circle.
 End node : represents the final step in the activity. The
end node is represented by an outlined black circle.
Activity Diagram
Activity diagram for Dormitory
Component Diagram
Component diagram shows the structure of the code where
as deployment diagram shows the structure of the runtime
system.

A component diagram contains components, interfaces and


relationships.

The component diagram's main icon is a rectangle that has


two rectangles overlaid on its left side.

You put the name of the component inside the icon.

The name is string.


Component Diagram
Interface is represented as a small circle connected to the
component by a solid line, which represents a realization
relationship.

The WebServer component provides two interfaces to


browsers: A browser can either request the content of a file
referred by a URL (GET) or post the content of a form
(POST). The WebServer component contains five classes:
URL, HttpRequest, DBQuery, File, and DBResult.
Deployment Diagram
iagramss
The UML deployment diagram shows the configuration of
run time processing elements and the software
components, process and object that live in them.

The UML deployment diagram provides a picture of how


the physical system will look when it's all put together.

A system consists of nodes (represented by a cube (6 equal


square)) with line connecting them, called connections.
There are two types of nodes: a processor (can execute a
component) and a device (interface with the real world).
Deployment diagrams are useful for modeling networks.
Deployment Diagram
iagramss
Eg.

Server Application
Web Page

AC
HTTP Database
* *
Browsers Apache

MYSQL
MYSQL
* *
Reading Assignment
Diagram extensions
Compare Aggregation and Composition
Thank You ...

You might also like