Chapter 2 - Overview of UMLupdated
Chapter 2 - Overview of UMLupdated
Engineering
Chapter 2-
An overview of UML
Prepared by:
Misganaw Abeje
University of Gondar
College Of Informatics
Department of computer science
[email protected]
Outline
Object oriented Methodologies
An overview of UML
Diagrams in the UML
– Use Case Diagrams
– Class Diagrams
– Sequence diagrams
– Activity diagram
– Deployment Diagram
– Component diagram. . .
BY: MA
Object oriented Methodologies
oriented development.
A methodology usually includes
– Notation : Graphical representation of classes and their
relationships with interactions.
– Process : Suggested set of steps to carry out for transforming
requirements into a working system.
– Tool : Software for drawings and documentation
BY: MA
An overview of UML
BY: MA
Characteristics of UML
The UML has the following features:
– It is a generalized modeling language.
– It is distinct from other programming languages like C+
+, Python, etc.
– It is interrelated to object-oriented analysis and design.
– It is used to visualize the workflow of the system.
– It is a pictorial language, used to generate powerful
modeling artifacts.
BY: MA
Diagrams in the UML
BY: MA
Components of use case diagram
BY: MA
How to draw a Use Case diagram?
Actor: WatchUser,
WatchRepairPerson
Usecase: ReadTime
SetTime
ChangeBattery
Example 2 Draw Use Case Diagram for ATM?
There are five types of relationships in a use case diagram. They are
Association between an actor and a use case
Generalization of an actor: actor can inherit the role of the other actor.
Extended : As the name implies it extends the base use case and
adds more functionality to the system. Here are a few things to
consider when using the <<extend>> relationship.
– The extending use case is dependent on the extended (base) use
case. In the below diagram the “Calculate Bonus” use case doesn’t
make much sense without the “Deposit Funds” use case.
– The extending use case is usually optional and can be triggered
conditionally
Include: Include use case is part of the including (base) use case.
The main reason for this is to reuse common actions across multiple
use cases. In some situations, this is done to simplify complex
behaviors
– The base use case is incomplete without the included use case.
– The included use case is mandatory and not optional.
BY: MA
BY: MA
Examples of include and extend
BY: MA
Example of a Use Case Diagram3 Online Shopping website
BY: MA
BY: MA
The View Items is further extended by several use cases
such as; Search Items, Browse Items, View
Recommended Items, Add to Shopping Cart, Add to Wish
list. All of these extended use cases provide some
functions to customers, which allows them to search for
an item.
Both View Recommended Item and Add to Wish
List include the Customer Authentication use case, as
they necessitate authenticated customers, and
simultaneously item can be added to the shopping cart
without any user authentication.
BY: MA
BY: MA
Similarly, the Checkout use case also includes the
following use cases, as shown below. It requires an
authenticated Web Customer, which can be done by
login page, user authentication cookie ("Remember
me"), or Single Sign-On (SSO). SSO needs an external
identity provider's participation, while Web site
authentication service is utilized in all these use cases.
The Checkout use case involves Payment use case that
can be done either by the credit card and external credit
payment services or with PayPal.
BY: MA
BY: MA
Important tips for drawing a Use Case diagram
BY: MA
UML Class Diagram
BY: MA
Purpose of Class Diagrams
BY: MA
Vital components of a Class Diagram
BY: MA
Middle Section: The middle section constitutes the
attributes, which describe the quality of the class. The
attributes have the following characteristics:
– The attributes are written along with its visibility factors, which are
public (+), private (-), protected (#), and package (~).
– The accessibility of an attribute class is illustrated by the visibility
factors.
– A meaningful name should be assigned to the attribute, which will
explain its usage inside the class.
Lower Section: The lower section contain methods or
operations. The methods are represented in the form of a
list, where each method is written in a single line. It
BY: MA
Simple example class diagram
BY: MA
Relationships
BY: MA
Generalization: A generalization is a relationship
between a parent class (superclass) and a child class
(subclass). In this, the child class is inherited from the
parent class.
For example, The Checking Account, Saving Account, and
Credit Account are the generalized form of Bank Account .
BY: MA
Association: It describes a static or physical connection
between two or more objects. It depicts how many
objects are there in the relationship.
For example, a department is associated with the college.
BY: MA
Multiplicity: It defines a specific range of allowable
instances of attributes. In case if a range is not specified,
one is considered as a default multiplicity.
For example, multiple patients are admitted to one
hospital.
BY: MA
Aggregation: An aggregation is a subset of association,
which represents has a relationship. It is more specific
then association.
It defines a part-whole or part-of relationship. In this kind
of relationship, the child class can exist independently of
its parent class.
The company encompasses a number of employees, and
even if one employee resigns, the company still exists.
BY: MA
Composition: The composition is a subset of aggregation.
It portrays the dependency between the parent and its
child, which means if one part is deleted, then the other
part also gets discarded. It represents a whole-part
relationship.
A contact book consists of multiple contacts, and if you
delete the contact book, all the contacts will be lost.
Composition is special type of Aggregation which is the
child object does not have their own life cycle.
BY: MA
Combined example of Aggregation and
Composition. vehicle can exist without driver. But
vehicle can not exist without Engine.
BY: MA
How to draw a Class Diagram?
A collection of class diagrams as a whole represents a system. Some
key points to keep in mind while drawing a class diagram are:
1. To describe a complete aspect of the system, it is suggested to
give a meaningful name to the class diagram.
2. The objects and their relationships should be acknowledged in
advance.
3. The attributes and methods of each class must be known.
4. A minimum number of desired properties should be specified as
more number of the unwanted property will lead to a complex
diagram.
5. Notes can be used as and when required by the developer to
describe the aspects of a diagram.
6. The diagrams should be redrawn and reworked as many times to
BY: MA make it correct before producing its final version.
Class Diagram Example: A class diagram describing the sales
order system is given below.
BY: MA
Example2 class diagram for ATM system
The bank class needs a code to identify it and an address. The methods that
the bank class can use to interact with its ATM are manage and maintain.
An ATM is managed by the bank and it has a location. Its methods are related
to transactions, which it identifies and carries out. The label “maintains”
explains the relationship between the bank and the ATM, while a bank may or
may not have more many ATMs.
Every bank needs customers, Customers need a name and an address. The
relationship between the bank and the customer is that the bank has
customers. The only method for the customer is to own an account and to own
a debit card.
An account is owned by a customer and also has a type, such as savings or
checking. It has a method to enable it to check the account balance.
BY: MA
The DebitCard class has a card number and is also owned by a customer.
Its method enables it to access the ATM and therefore the account. Now we
need to model the transactions that can take place when the customer uses
the ATM. The base class for this is ATMTransaction. It has three attributes:
transaction ID, date, and type. Its method is to update. Let’s imagine that the
customer can perform two different types of transactions. They can withdraw
funds or they can transfer funds to another account.
a WithdrawalTransaction class has an amount attribute and a withdrawal
method. a TransferTransaction class also has an amount attribute, but in
addition it has an account number attribute so that the customer can send
the money to a different account.
These two transaction are share the ATMTransaction class as their parent
class. For instance, these transactions can make use of the update method
to interact with the account class.
BY: MA
BY: MA
Sequence Diagram
BY: MA
Purpose of a Sequence Diagram
BY: MA
Notations of a Sequence Diagram
BY: MA
Activation
BY: MA
Messages
The messages depict the interaction between the objects and are
represented by arrows. They are in the sequential order on the
lifeline. The core of the sequence diagram is formed by messages
and lifelines.
Call Message: It defines a particular communication between the
lifelines of an interaction, which represents that the target lifeline has
invoked an operation.
BY: MA
Return Message: It defines a particular communication
between the lifelines of interaction that represent the flow
of information from the receiver of the corresponding
caller message.
BY: MA
Self Message: It describes a communication, particularly between
the lifelines of an interaction that represents a message of the same
lifeline, has been invoked.
Recursive Message: A self message sent for recursive purpose is
called a recursive message. In other words, it can be said that the
recursive message is a special case of the self message as it
represents the recursive calls.
BY: MA
Create Message: It describes a communication,
particularly between the lifelines of an interaction
describing that the target (lifeline) has been instantiated.
Destroy Message: It describes a communication,
particularly between the lifelines of an interaction that
depicts a request to destroy the lifecycle of the target.
BY: MA
Duration Message: It describes a communication
particularly between the lifelines of an interaction, which
portrays the time passage of the message while modeling
a system.
Note: A note is the capability of attaching several remarks
to the element. It basically carries useful information for
the modelers.
BY: MA
Example 1 Sequence Diagram for simple-watch
system,
BY: MA
The first call is sendOrder () which is a method of Order
object. The next call is confirm () which is a method
of SpecialOrder object and the last call is Dispatch
() which is a method of SpecialOrder object.
Benefits of a Sequence Diagram
– It explores the real-time application.
– It depicts the message flow between the different objects.
– It has easy maintenance.
– Implement both forward and reverse engineering.
– It can easily update as per the new change in the system
BY: MA
The drawback of a Sequence Diagram
BY: MA
UML Activity Diagram
BY: MA
BY: MA
Why use Activity Diagram?
BY: MA
Example of an Activity Diagram
BY: MA
Activity diagram ATM System
BY: MA
BY: MA
Example 3 Activity Diagram - Modeling a Word Processor
BY: MA
Symbol and notation of Deployment diagram
BY: MA
How to draw a Deployment Diagram?
BY: MA
Example of a Deployment diagram
Before drawing a deployment diagram, the following artifacts should
be identified −
– Nodes and Relationships among nodes
The Following is a sample deployment diagram to provide an idea of
the deployment view of order management system. Here, we have
shown nodes as −
– Monitor
– Modem
– Caching server
– Server
The application is assumed to be a web-based application, which is
deployed in a clustered environment using server 1, server 2, and
server 3. The user connects to the application using the Internet. The
control flows from the caching server to the clustered environment.
BY: MA
Deployment diagram example…
BY: MA
When to use a Deployment Diagram?
BY: MA
Purpose of a Component Diagram
BY: MA
Why use Component Diagram?
BY: MA
Where to use Component Diagrams?
BY: MA
Library Management System
Problem Statement:
BY: MA
Chapter 3: System Analysis
– Overview
– Use case diagram
– Class diagram
– Sequence diagram
– Activity diagram
Chapter 4 system Design:
– Overview
– System architecture
– Deployment diagram
– Component diagram
– Persistent data model
BY: MA
THANK YOU !