CH 2

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 62

Chapter Two

Overview of UML
Set by Tesfahun N.
Outline

 An overview of UML.
 Use Case Diagrams
 Class Diagrams
 Sequence diagrams
 State chart diagrams
 Activity diagrams
 Component diagram
 Deployment diagram
UML – Unified modeling language

UML is a pictorial language used to make software


blueprints.

The UML is a standard graphical design for presenting


important analysis and design concepts

It is used to easily :-


specifying,

visualizing,

Design

constructing of software systems


Cont..
UML specification defines two major kinds of UML diagram:

Structure diagrams:-
 show the static structure of the system and its parts on different abstraction and
implementation levels and how they are related to each other.

 The elements in a structure diagram represent the meaningful concepts of a


system, and may include abstract, real world and implementation concepts.

Behavior diagrams:- show the dynamic behavior of the objects in a


system, which can be described as a series of changes to the system over
time
Contt
UML Diagrams

Use Case Diagrams


Class Diagrams
Sequence Diagrams
 Activity Diagrams
State chart Diagrams
Deployment diagram
Etc..
USE CASE DIAGRAMS
Use Case Diagrams

It is a dynamic UML diagram used to express


behaviour of the system .
It encapsulates the system's functionality by
incorporating use cases, actors, and their relationships.
It is simplest representation that shows :-
 the interaction between the system and users
Is shows the relationship between the user and different use
cases.
 A Use Case diagram consists of
 use cases,
Actors
system boundary
Relation
Actor

 it is some one or something outside the system that


interacts with the system.

An actor is anything that exchanges data with the


system.

An actor can be a user, external hardware, or another


system.

Represented as =>
How to Find Actors

Which is capable to do the following task can be


considered as the actor
Supply/use/remove information

Use the functionality.

Will support/maintain the system.

The system’s external resources.

The other systems will need to interact with this one.


Documenting Actor Characteristics

We should considered the following questions or


description
Brief Description for each actors
Why the actor is needed?
What will do the actor in the system?
Actor characteristics might influence how the system is
developed
The actor's scope of responsibility.
Use case

A use case is a list of actions or event steps that helps the


achieve the goal of the system .
It is a technique for capturing, modelling and specifying the
requirements of a system.
It is represented by oval circle
How to Find Use Cases

We can find the use case of the system by analyzing the
following pointes
What are the system tasks for each actor you have identified?

Does the actor need to be informed about certain occurrences in


the system?
Can all features be performed by the use cases you have
identified?
What information must be modified or created in the system?
System boundary
 It is rectangle diagram representing the boundary
between the actors and the system.
 Use Case Diagram(core relationship)
 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)
 Represented by a line with a triangular arrow head toward the
parent use case.
Cont.

Include: a dotted line labeled <<include>> beginning at base use


case and ending with an arrows pointing to the include use case.
 It occurs when a chunk of behavior is similar across more than one use case

<<include>>

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”.

<<extend>>
Example: Library management
System
Use Case Diagrams(cont.)
Cont.
Pay Bill is a parent use case and Bill Insurance is the child
use case. (generalization)

Both Make Appointment and Request Medication include


Check Patient Record as a subtask.(include)

The extension point is written inside the base case

Pay bill; the extending class Defer payment adds the


behavior of this extension point. (extend)
Class diagram
Used for describing structure and behavior in the
use cases

Provides a conceptual model of the system in terms


of entities and their relationships

Used for requirement capture, end-user interaction

Detailed class diagrams are used for developers


Class representation
Each class is represented by a rectangle subdivided into
three compartments
Name
Attributes
Operations
Modifiers are used to indicate visibility of attributes and
operations.
‘+’ is used to denote Public visibility (everyone)
‘#’is used to denote Protected visibility (friends and derived)
‘-’is used to denote Private visibility (no one)
An example of Class
OO Relationships

There are two kinds of Relationships


Generalization (parent-child relationship)
In generalization, one element is a specialization of another
general component. It may be substituted for it.
 It is mostly used to represent inheritance

Association (student enrolls in course)


It is a structural relationship that represents objects can be associated
with another object inside the system
Associations can be further classified as

Aggregation :- an object of one class can own or access the objects of


another
E.g. A car needs a wheel to function correctly, but a wheel doesn't
always need a car.
Composition:-It is not a standard UML relationship, but it is still used
in various applications.
It is a whole/part relationship.
If a composite is deleted, all other
parts associated with it are deleted.
OO Relationships: Generalization
OO Relationships:
Association
Represent relationship between instances of classes
Student enrolls in a course

Courses have students

Courses have exams Etc.

Association has
Role names (e.g. enrolls)

Multiplicity (e.g. One course can have many students)

Navigability (unidirectional, bidirectional)


Association: Multiplicity and Roles
student
1 *

University Person

0..1 *
employer teacher

Role
Multiplicity
Symbol Meaning Role
1 One and only one “A given university groups many people;
0..1 Zero or one some act as students, others as teachers. A
M..N From M to N (natural language) given student belongs to a single
university; a given teacher may or may not
* From zero to any positive integer
be working for the university at a
0..* From zero to any positive particular time.”
1..* integer From one to any positive
integer
OO Relationships: Composition
Whole Class  Composition: expresses a relationship
Class W among instances of related classes.

 It is a specific kind of Whole-Part


Class P1 Class P2
relationship.
Part Classes  It expresses a relationship where an
instance of the Whole-class has the
responsibility to create and initialize
Example instances of each Part- a.

Automobile
 It may also be used to express a relationship
where instances of the Part-classes have
privileged access or visibility to certain
Engine Transmission attributes and/or behaviors defined by the
Whole-class.
OO Relationships: Aggregation
Container Class
Class C  Aggregation: expresses a relationship among
instances of related classes.
AGGREGATION  It is a specific kind of Container-Containee
relationship.
Class E1 Class E2  It expresses a relationship where an instance of the
Container-class has the responsibility to hold and
maintain instances of each Container-class

Example
 Aggregation should be used to express a more
informal relationship than composition expresses.
Bag That is, it is an appropriate relationship where the
Container and its Containees

 Aggregation is appropriate when Container and


Apples Milk Containees have no special access privileges to
each other.
Aggregation vs. Composition

Composition is really a strong form of aggregation

components have only one owner

components cannot exist independent of their owner

components live or die with their owner

e.g. Each car has an engine that can not be shared with other cars.

Aggregations may form "part of" the aggregate, but may not be

essential to it.

They may also exist independent of the aggregate.

e.g. Apples may exist independent of the bag.


Part 2 ….
Interaction Diagram
Interaction Diagram

It is a diagram representation used to describe the

interactions among different elements or object

The purpose of interaction diagrams is to visualize the

interactive behavior of the system.

It shows the flow of messages within a system


Cont.

The purposes of interaction diagram can be


describes as:
To capture dynamic behavior of a system.
To describe the message flow in the system.
To describe structural organization of the objects.
 To describe interaction among objects.
Cont.

The following factors are to be identified clearly before


drawing the interaction diagram:
Objects taking part in the interaction.
Message flows among the objects.
The sequence in which the messages are flowing.
This interactive behavior is represented in UML by two
diagrams known as
Sequence diagram and
 Collaboration diagram
sequence diagram

 it is a type of interaction diagram it describes how and


in what order a group of objects works together.
 it is known as event diagrams or event scenarios
It is a good way to visualize and validate various runtime
scenarios.
It shows different parts of a system work in a ‘sequence’
to get something done
It emphasizes on time sequence of messages
Basic Sequence Diagram Notations

Class Roles or Participants:-


it describe the way an object will behave in context.

 Use the UML object symbol to illustrate class roles, but don't list object
attributes.

Activation or Execution Occurrence:-it represent the


time an object needs to complete a task.
Cont..

Self Message: A message an object sends to


itself, usually shown as a U shaped arrow
pointing back to itself.

Message flow :
Example :-Sequence Diagram(Telephone call)
Sequence Diagrams – Object Life Spans

 Creation
A
 Create message
 Object life starts at that point
 Activation Create
B
 Symbolized by rectangular
stripes
 Place on the lifeline where
object is activated.
 Deletion
 Placing an ‘X’ on lifeline
Activation bar
X
 Object’s life ends at that point Return
Deletion
Lifeline
Collaboration Diagram

It also shows the passing of messages between objects,


but focuses on the objects and messages and their order

It emphasizes on the structural organization of the


objects that send and receive messages

The sequence are identified using sequence numbers.

it is better for real-time specifications and for complex


scenarios than sequence diagrams.
Collaboration Diagram(Telephone call)
State chart Diagrams

A State chart diagram describes a state machine.

 State machine is machine which defines different states of an


object and these states are controlled by external or internal
events

 State chart diagrams are useful to model the reactive systems.

Reactive systems can be defined as a system that responds to


external or internal events.
Cont..

 it describes the flow of control from one state to another


state.

States are defined as a condition in which an object exists


and it changes when some event is triggered.

The most important purpose of State chart diagram is to


model lifetime of an object from creation to termination.

It differ from activity diagram is consist of triggered


states.
Cont..

Why we use state chart diagram ?


To model the dynamic aspect of a system.
To model the life time of a reactive system.
To describe different states of an object during its
life time.
Define a state machine to model the states of an
object.
Symbols and notation of state chart diagram

Start:-Start state symbol signals the first step of a


process.

Transition:-symbol stands for the result of a process

Decision:-Decision were introduced in UML to


support conditionals in activities.

State :-State defines current condition of an event or


activity.

End state :-End state symbol stands for the result of


a process.
Cont..

Sample of stat charet diagram


Cont..

▪ E.g. login page


Cont.

Activity diagram is basically a flow chart to represent the


flow form one activity to another activity.

The activity can be described as an operation of the


system.

So the control flow is drawn from one operation to another.

This flow can be sequential, branched or concurrent.

Activity diagrams deals with all type of flow control by


using different elements like fork, join etc.
Cont.

It captures the dynamic behavior of the system.

Other four diagrams are used to show the message flow


from one object to another but activity diagram is used to
show message flow from one activity to another.

The only missing thing in activity diagram is the message


part.
How to draw Activity Diagram?

 before drawing an activity diagram we should

identify the following elements:


 Activities

 Association

 Conditions
Basic Activity Diagram Notations and Symbols

Initial State or Start Point:-A small filled circle followed by an


arrow represents the initial action state or the start point

Activity or Action State:-An action state represents the non-


interruptible action of objects.

End :- the end of concurrent activities.


Cont..

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.

Decisions and Branching:-A diamond represents a decision


with alternate paths.

When an activity requires a decision prior to moving on to the next


activity, add a diamond between the two activities.
Example : login page
Uses of Activity Diagrams

Modeling work flow by using activities.

Modeling business requirements.

High level understanding of the system's


functionalities.
Deployment Diagrams

shows the execution architecture of a system, including


nodes such as hardware or software execution
environments, and the middleware connecting them.

It is used to visualize the physical hardware and software


of a system.

 it helps to understand how the system will be physically


deployed on the hardware.

It help model the hardware topology of a system compared


Deployment Diagram Notations

Nodes:-A node, represented as a cube, is a physical entity that


executes one or more components, subsystems or executables. A
node could be a hardware or software element.

Artifacts:-Artifacts are concrete elements that are caused by a


development process. E.g. libraries, archives, configuration files,
executable files etc.
Cont.

 a solid line between two nodes shows the path of


communication between nodes.
How to Draw a Deployment Diagram

Follow the simple steps below to draw a deployment


diagram.
Step 1: identify the nodes and devices within the system you’ll be

visualizing with the diagram.


Step 2: Figure out the relationships between the nodes and devices

Step 3: Identify what other elements like components, active

objects you need to add to complete the diagram.


Step 4: Add dependencies between components and objects as

required.
Cont..

▪ Deployment Diagram
Component diagram

It is a diagram describes how components are wired


together to form larger components or software systems.

It is often used to illustrate the pieces of software,


embedded controllers and some other parts that make up
a system and the structure of a it.

 its main purpose it to show the structural relationships


between the components of a system.
The Usage of UML Component Diagram

It is used to visualize the static implementation view of a system


and describe the organization of the components in a system.

Software designers and developer usually use it to model the


components of a system, database schema, executables of an
application and system’s source code.

To model hardware details for a client/server system and a


distributed application.
Reading assignment

read more about Component


diagram ????
Thank you ???

You might also like