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

Unified Modelling Language (UML)

Contents

1. Introduction to Unified Modelling Language - UML


2. Use Case Diagrams
3. Class Diagrams
4. Behavioural Diagrams
5. Implementation Diagrams

Literature

1. Developing Software with UML, Bernd Oestereich,


Addison Wesley, 1999.
2. Practical Object-Oriented Design with UML, Mark Priestley,
McGraw-Hill, Second Edition, 2003.
3. Using UML, Software Engineering with Objects and Components,
Rob Pooley, Perdita Stevens, Addison Wesley, 1999.
4. UML Distilled, 2nd Edition, Martin Fowler, Kendall Scott,
Addison Wesley, 2000.
5. UML in Practice, Pascal Roques, Wiley, 2004.

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 1
Introduction to Unified Modelling Language - UML

) UML - language and notation for specification, construction,


visualisation and documentation of models of
software systems.

) Developed by Grady Booch, Ivar Jacobson, James Rumbaugh

Types of diagrams:
• use case diagrams
• class diagrams
• behavioural diagrams
• implementation diagrams

• UML modelling language

Methods: modelling language + process

notation that methods steps in doing a design


use to express design

) UML is not:
programming language
a CASE tool
method

•Associate with UML is Unified Software Development Process

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 2
• Grady Booch (Rational Software)
Object-Oriented Analysis and Design with Applications,
Second Edition, Addison Wesley, 1994.
• James Rumbaugh (General Electric)
Rumbaugh, J., Blaha, M., Premerlani, W., Eddy F., Lorenzen, W.,
Object-Oriented Modeling and Design, Prentice hall, 1991.
• Ivar Jacobson (Ericsson)
Jacobson, I., Ericsson, M., Jacobson, A., The Object Advantage:
Business Process Reengineering with object Technology,
Addison-Wesley, 1995.

Object Management Group an industry standards body requested


standard object modelling language (1996).

Use Case Diagrams

Contents

1. Use Case
2. Actors
3. Use Case Diagrams

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 3
Use case

Definition
Describes a task that a user can perform using the system.

Description
• describes requirements for the system
• task described by a use case is composed of activities
• use case can have different variations called scenarios
• should not be used for functional decomposition !

Example. Automatic teller machine (ATM)

ATM offers the following services:

1. Distribution of money to every holder of a smartcard via


a card reader and a cash dispenser.
2. Report of account balance, cash and cheques deposit facilities
for bank customers who hold a smartcard from their bank.

In addition:

3. All transactions are made sure.


4. The dispenser has to be refilled from time to time.

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 4
Withdraw money using a Visa card
Summary: This use case allows a Visa card holder, who is not a
customer of the bank to withdraw money if his/her daily limit allows it.

1. The Visa CardHolder inserts his/her smart card in the ATM’s card
reader.
2. The ATM verifies that the card that has been inserted is a smartcard.
3. TheATM asks the Visa CardHolder to enter his/her pin number.
4. The Visa CardHolder enters his/her pin number.
5. The ATM compares the pin number with the one that is encoded
on the chip of the smartcard.
6. The ATM requests an authorisation from the Visa authorisation system
7. The Visa authorisation system confirms its agreement and indicates
the daily withdrawal limit.
8. The ATM asks the Visa CardHolder to enter the desired
withdrawal amount.
9. The Visa CardHolder enters the desired withdrawal amount.
10. The ATM checks the amount against the daily withdrawal limit.9

11. The ATM asks the Visa CardHolder if he/she would like a receipt.
12. The Visa CardHolder requests a receipt.
13. The ATM returns the card to the Visa CardHolder.
14. The Visa CardHolder takes his/her card.
15. The ATM issues the banknotes and a receipt.
16. The Visa CardHolder takes the banknotes and the receipt.

Variations: Temporarily incorrect pin number


At step 5, the Visa CardHolder fails to enter a correct pin number
6. The ATM informs the CardHolder that the pin is incorrect for the
first or second time.
7. The ATM records the failure on the smartcard.
The scenario goes back to step 3.

Variations: The amount requested is greater than the daily


withdrawal limit

10

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 5
Variations: The Visa CardHolder does not want a receipt

Error: Invalid card



Error: Conclusively incorrect pin number

Error: Unauthorised withdrawal

Error: The card is not taken back by the holder

Error: The banknotes are not taken back by the holder

11

Notation
UcNo. Name of use case: Withdraw money using a Visa card
Actors: Visa CardHolder, Visa AS
Preconditions:
the ATM cash box is well stocked
there is no card in the reader
Postconditions
the amount of money in the ATM changes
Invariants
Non-functional requirements
response time: within a maximum time limit of 2 seconds
confidentiality: the procedure of comparing the
pin number that has been entered on the keyboard of the
ATM with that of the smartcard must have a maximum failure rate of 10-6
Process description
Exceptions, error situations
Variations 12
Rules

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 6
(Notation continued)

Services
Contact partners, sessions
Notes/open questions
Documents, references, dialog samples
Diagrams: sequence and collaboration, class, activity and state

13

Actors

Definition
Actor is an external entity which is involved
in the interaction with the system described in a use case.

Description
• actors = roles
• actors can be also dialogs, and external systems

Notation

<<actor>> <<actor>>
Customer Customer Customer dialog
14

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 7
• generalisation and specialisation of actors

Example

Office clerk

Home insurance Car insurance Field service clerk


clerk clerk

15

Use Case Diagram

Definition
Shows the relationships between a set of use cases and the actors
involved in these use cases.

Description
• tool for requirement determination
• use case describes those activities which are to be supported by the
software under development
Diagram name
Notation
Use case1 Actor2
Actor1 Use case 2

Use case 3
Actor3
16

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 8
ATM offers the following services:

1. Distribution of money to every holder of a smartcard via


a card reader and a cash dispenser.
2. Report of account balance, cash and cheques deposit facilities
for bank customers who hold a smartcard from their bank.
3. All transactions are made sure.
4. The dispenser has to be refilled from time to time

17

Initial use case diagram for the ATM

Withdraw money

CardHolder Refill dispenser

Consult balance
Maintenance
Retrieve swallowed cards operator
BankCustomer

Deposit cash

Retrieve cheques

Deposit cheques

18

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 9
Improved diagram

Withdraw money
CardHolder

Refill dispenser

Consult balance
Maintenance
Retrieve swallowed cards operator
BankCustomer

Deposit cash

Retrieve cheques

Deposit cheques

19

More actors
<<Actor>>
Visa AS

VisaCardHolder Withdraw money

<<Actor>>
Consult balance Bank IS

BankCustomer

Deposit cash

Deposit cheques

Problem: if the actor is Visa card holder the Visa AS must be called on,
Whereas the Bank IS will be contacted for a bank customer!
Not presented on the diagram! 20

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 10
Another improvement

<<Actor>>
VisaAS

Withdraw money using a Visa card


VisaCardHolder

<<Actor>>
Bank IS

Withdraw money using a bank card


BankCustomer

21

Relationships between use cases

• include: base use case includes the functionality of included use case
• extend: a use case is optionally extended by functionality of
another use case
• generalisation: sub use case inherits behaviour and
semantics from super use cases

Included Base Super


use case use case use case

<<extend>>
<<include>> (extension point)

Base Extending Sub


use case use case use case

22

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 11
Example of an include relationship

Deposit cheques Deposit cash

<<include>>
<<include>>
<<include>>

Consult balance

Authenticate
<<include>> <<include>>

Withdraw money using a bank


card Withdraw money using a Visa card

Problem: users have to re-authenticate themselves for each kind of


transaction. 23

Example of an extend relationship

<<extend>>
(verify amount)
extension points
verify amount
Consult balance Withdraw money using a bank card

7. The BankIS confirms its agreement and indicates the daily


withdrawal limit.
8. The ATM asks the BankCustomer to enter the desired
withdrawal amount.
Extension point: Verify amount
9. The BankCustomer enters the desired withdrawal amount.
10. The ATM checks the amount against the daily withdrawal limit.
24

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 12
Example of a generalisation relationship

<<Actor>>
Bank IS

BankCustomer Deposit money

<<include>>

Deposit cheques Deposit cash

Authenticate

25

Final use case diagram


<<Actor>>
Visa IS

Withdraw money using a Visa card


Visa CardHolder

<<Actor>>
Bank IS
Withdraw money using a bank
card
BankCustomer
<<extend>> <<include>>
(Verify amount) <<include>>

<<include>>

<<include>>
Consult balance Authenticate

Deposit money

Deposit cash 26
Deposit cheques

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 13
Final use case diagram (continued)

Refill dispenser

Maintenance operator Retrieve swallowed cards

Retrieve cheques

27

How to identify use cases?

• Define the list of actors


then try to work out the use cases for each actor

• Identify external events to which system/user reacts.

28

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 14
Summary

• Use-case modelling is a technique used to describe the functional


requirements of a system.

• Use case diagrams consist of actors and use cases.

29

Object-Oriented Methods, School of Computer


Science and IT, University of Nottingham 15

You might also like