You are on page 1of 76

Object-Oriented Analysis

(OOAD)
Lec07 # Requirement Modeling with
UML

.
http://www.siam2dev.com
xnattapong@hotmail.com
1

Lecture Outline

Software Modeling
Require and Domain Analysis
Model
Design Model
Brief Overview of Unified Modeling
Language (UML)
Use Case Model

What is Modeling?

(Modeling)
(Analysis
and Design)



Visual Modeling

Software Modeling
User
User
Requirement
Requirement

Modeling
Modeling
(Analysis
(Analysisand
andDesign)
Design)

Model
Model
(Specification)
(Specification)

Manually
Manually
Coding
Coding

Tools
Tools

Program
Program

Models

Requirement Analysis Models (Requirement


Specification)

(Requirement Analysis)
Analysis Model

(System Analysis)
Design Model

(System Design)

Software Development Process

Requirement Specification : define problem domain


Analysis : what problem to be solved?
Design : how to solve the problem?
Implementation : how to implement the solution?
Testing : how to ensure that the solution can solve
the problem?
Maintenance : how to adjust the solution to
accomodate change?
Retirement : when does the system to be retired?

Structured Analysis Models


Data Flow Diagrams
Entity Relationship Diagrams
State-Transition Diagrams

Object-Oriented Analysis
Models

Use-case Diagrams
Class and Object Diagrams
Behavioral Diagrams

The Unified
Language

Modeling
(UML)

What is UML?


(Modeling Language)

3 / Booch,
Rumbaugh Jacobson



What is NOT UML?

(Programming
Language)

method methodology
Process
UML
Process
Process

modeling language

History of UML

1970s (Object-oriented method)


1970s, 1980s, 1990s Method Wars

Grady Booch, Jim Rumbaugh, Ivar Jacobson

3 /
1990s
OOSE (Object-Oriented Software Engineering)
Ivar Jacobson
OMT (Object Modelling Technique) Jim
Rumbaugh
Booch method Grady Booch

Histroy of UML

1994/5 Booch, Rumbaugh Jacobson


( three amigos)


Rational Software
Three Amigos Unified Modelling
Language (UML) OMG (Object
Management Group)

UML Version 1.1 1997

Histroy of UML

1998 UML Version


1999 UML Version
2000 UML Version
2001 UML Version
http://www.uml.org/

1.2
1.3
1.4
2.0

Models and Diagrams

A model is a complete
description of a system
from a particular
perspective

Use Case
Use Case
Diagrams
Sequence
Diagrams
Diagrams
Scenario
Scenario
Diagrams
Collaboration
Diagrams
Diagrams
Scenario
Scenario
Diagrams
Statechart
Diagrams
Diagrams

Use Case
Use Case
Diagrams
Use Case
Diagrams
Diagrams

State
State
Diagrams
Class
Diagrams
Diagrams

Models

State
State
Diagrams
Object
Diagrams
Diagrams

State
State
Diagrams
Component
Diagrams
Diagrams
Component
Component
Diagrams
Deployment
Diagrams

Activity
Diagrams

Diagrams

Lifecycle Phases
Inception

Elaboration

Construction

Transition

time

Inception Define the scope of the project and


develop business case
Elaboration Plan project, specify features, and
baseline the architecture

Construction Build the product


Transition Transition the product to its users

UML has 9 kinds of diagrams

Class Diagram
Object Diagram
Structural
Component Diagram Diagrams
Deployment Diagram
Use Case Diagram
Sequence Diagram
Behavioral Diagrams
Collaboration Diagram
StateTransition Diagram
Activity Diagram

UML(Unified Modeling
Language)
UML

5
Use-case view :



use-case diagram
Logical view :
static
structure dynamic behavior
class diagram, object diagram, state,
sequence, collaboration, activity diagrams

UML(Unified Modeling
Language)
Component view :
implement

dependency

component diagram
Concurrency view: process processors
communication synchronization
dynamic diagrams (state, sequence, collaboration
activity)
implementation diagrams(component deployment)
Deployment view :

deployment diagram

Class Diagrams

Class diagrams

Class
Class logical view


UML class diagrams
Class, Class
Class
Multiplicity navigation
Role

Association, aggregation,
dependency, inheritance

Classes in UML

Class name
Person
Attributes
attribute name : type
Operations
operation name(parameter : type)
: result type

Person
- TaxIDNo : String
- Name : String
+ Income : double
+ TaxPaid : Boolean
+ calcTax()
+ calcTaxBal()

A Class Diagram
Actuator

startUp( )
shutDown( )

generalization
Light

Heater

off( )
on( )

aggregation

Cooler

Temperature

0..*
1
1

Environmental Controller
define_climate( )
terminate_climate( )

SystemLog
display( )
recordEvent( )

An Object Diagram
Account
#31421123
Victoria High Street
Branch
(A Branch Object)

Account
#741421123
Account
#521665423

London Road
Branch
(A Branch Object)

Account
#31421123
Account
#31421123
Account
#714559543

Component Diagram
Component Diagram


Component

A Component Diagram
Register.exe

Billing.exe
Billing
System

People.dll
Course.dll

Course

Student
Course

Course
Offering

User

Professor

Deployment Diagram
Deployment Diagram

physical Architecture

1
1 component

A Deployment Diagram
Account
Server

Account
Server
Deploys
AccountDB.java
AccountMgt.java

AccountDB.java

AccountMgt.java

Use Case Diagram


Use Case

Use Case
- Create Order (
)
- Modify Order (
)
- Delete Order ()

Use Case Diagram


Use Case

Use Case Diagram


2
actor use case

A Use Case Diagram


Track
Order

<<include>>

Validate
Client
<<include>>

Trader

Place
Order
Stock
Exchange

<<extend>>
Place
Rush
Order

<<include>>

Retinal
Scan

Check
Password
Establis
h
Credit

Financial
Officer

Sequence Diagram
Sequence Diagram


massage


message

A Sequence Diagram
: Student

registration
form

registration
manager

math 101

math 101
section 1

1: fill in info
2: submit
3: add course(joe, math 01)
4: are you open?

5: are you open?

6: add (joe)
7: add (joe)

Collaboration Diagram
Collaboration Diagram




A Collaboration Diagram
1: set course info
2: process

course form :
CourseForm

3: add course

: Registrar

theManager :
CurriculumManager

aCourse :
Course
4: new course

State-Transition Diagram
State-Transition Diagram

A State-Transition Diagram
Add student[ count < 10 ]
Initialization
do: Initialize course

Add Student /
Set count = 0

Open
entry: Register student
exit: Increment count

Cancel
Cancel

[ count = 10 ]

Canceled
do: Notify registered students
Cancel

Closed
do: Finalize course

Activity diagram

(workflow)

Activity



(State)



An Activity Diagram
Ordinary Example

Swimlane
Example

Show
MessageBox
Printing
on Screen

Create postscript
file

Remove
MessageBox

Send postscript
file to printer

displayer

sampler

Benefits of UML


(Standard Visual Modeling
Language)




(Programming Language)


Use Case Model

System Analysis

(system analysis phase)


what
how

(Requirement analysis phase)


(Requirement Model) Output

System Analysis and Use Case

Use Case Model



functional requirement


( what)


UML Use Case Description
(Text) Use Case Diagram(Diagram)

Use Case Example

Place Order

Stock
Exchange
Market

Name: (Place Order)


Main flow of events:
Trader

1. Trader client
2. System (Validate) credit
client
3. Trader
Client
4. System
6. System order
7. System order

8. System Trader

Use Case Diagram

Use Case

(
)

Use Case - /
Actor - / Use Case
Relationship -
Use Case Actor
System -

Use Case Modeling : Core


Elements
Construct Description
Syntax
use case

actor

A sequence of actions, including


variants, that a system (or other
entity) can perform, interacting with
actors of the system.
A coherent set of roles that users
of use cases play when interacting
with these use cases.

U seC aseN am e

A c to rN a m e

system
boundary

Represents the boundary between


the physical system and the actors
who interact with the physical
system.

Use Case Modeling : Core


Relationships
Construct
Description
Syntax
association

The participation of an actor in a use


case. i.e., instance of an actor and
instances of a use case communicate
with each other.
generalization A taxonomic relationship between a
more general use case and a more
specific use case.
extend
A relationship from an extension use
case to a base use case, specifying
how the behavior for the extension
use case can be inserted into the
behavior defined for the base use
case.

<<extend>>

Use Case Modeling : Core


Relationships (contd)

Construct

Description

include

An relationship from a base use case


to an inclusion use case, specifying
how the behavior for the inclusion use
case is inserted into the behavior
defined for the base use case.

Syntax
<<include>>

Use Cases v.s. Scenario

Use Case

Use Case transactions

Scenario

Scenario instance
use case
a user
withdrawals
$200
withdrawal

cash

Actors

Actor someone some thing




information
Use Case



Actors
Customer -- maintain their account
Cashier -- verify withdrawal Customer
amount Cashier

Actors

Actors Specialization
Relationship
Customer

ATM Customer

specialization
relationship

Cashier Customer

Actors UML
relationships

Actors

use cases
( association)
association =
(
messages )

Customer

withdrawal cash

generalization relationships
actors
Association Implement
Actor

System

System
Software system, business,
hardware,..
use-case modeling

(system boundary)

System

Relationships between Use


Case

Extends : generalization relationships


Use Case (extends) Use Case
(actions)
Includes/Uses : generalization relationship
Use Case (uses) Use
Case
Use Case

Generalization Relationship
Validate
client

Check
passwor
d

Retinal
scan

Child Use case



Parent Use Case
Child
Parent

Child
Parent

Include relationship

(flow of events)
Use Case
<<include>>
Place
order

Validate
client

<<include>>
Track
order

copy & paste Use Case


Descriptions

Include Example

Track Order

<<include>>

Validate
Client

Name :

(Track Order)
Main flow:
1. order
Obtain and
verify order number
2. Include
Validate client
3.
Order

Extend relationship
Place order
Extension
points:
Set priority
<<extend>>
(set priority)

Place rush
order


Use Case user
optional

conditional subflows
subflows

Actors

Extend Example

Place Order

<<extend>>

Place Rush
Order

Name : (Place
Order)
Main flow of events:
1.
2. Trader
Client
3. (set priority)
4. System order
5. ...

Relationships between Use


Case
Validate
Account
<<include>>

Withdrawal
Cash

Ship Order

<<extend>>

Ship Partial
Order

Comparing extends/uses

extend
Use Case
actors Use case Use
Case extend
actor base Use Case
include/use
extract
actor Use Case

actors for caller use cases possible

A Use Case Diagram


Track
Order

<<include>>

Validate
Client
<<include>>

Trader

Place
Order
Stock
Exchange

<<extend>>
Place
Rush
Order

<<include>>

Retinal
Scan

Check
Password
Establis
h
Credit

Financial
Officer

Customer

A Use Case Diagram


Deposit

Transfe
r
Validate
Account
<<include>>

<<include>>

Withdraw
<<include>>
Balance
Checking

Verify
withdrawa
l

Bank
Teller

When and how?

Requirements capture

Reuqirement
(Model) ser requirements
Use Case

Test Scenarios

(Model)
(test scenarios) Use Case

Use Case:
customer

Use Case

Finding Actors

actor

(primary
actors)?
?
(secondary actors)?
Hardware devices ?

?
output
?

Tips

users
users

Finding Use Cases

actor

actor ?
actor
?
actor ?
actor ?

actor ?

actors

input/output ? input/output
?
?

Recipe

actors



actors


actors use cases
Use Case

Use case

Use case

- Use Case
- (Overview)
- Actor (Primary Actor)
- Actor (Secondary Actor)
- (Starting Point)
- (End point)
- Use Case (Flow of Events)
- Use Case
(Alternative flow of Events)
- Use Case (Measurable
Result)

Use Case : Create Order

(Overview)
Use Case

Actor (Primary Actor)



Actor (Secondary Actor)

(Starting Point)
Use Case Actor

(End point)

Use Case : Create Order

Use Case (Flow of Events)


User Interface
Actor

(Required Date)
(Quantity)
(ShipVia)
(ShipAddress) Actor

Actor

Use Case : Create Order


Use Case
(Alternative Flow of Events)

Actor
Use Case
Use Case (Measurable
Result)
1

Cash Register Example


Use Case:

Buy items

Actors:

Customer, Cashier

Type:

Primary

Description:

A Customer arrives at a checkout with items to


purchase. The Cashier records the purchase items
and collects payment. On completion, the
Customer leaves with the items

Expanded Use Case Example


Use Case:

Buy Items with Cash

Actors:

Customer (initiator), Cashier

Purpose:

Capture a sale and its cash payment

Overview:

A Customer arrives at a checkout with items to


purchase. The Cashier records the purchase
items and collects a cash payment. On
completion, the Customer leaves with the items.

Type:

primary and essential

Cross references:

R1.1, R1.2, R1.7

Expanded Use Case (2)


TYPICAL COURSE OF EVENTS
ACTOR ACTION

1. This use case begins when a


Customer arrives at the
register with items to
purchase.
2. The cashier records the
identifier from each item. If
more than one of the same
item, the Cashier can enter
the quantity as well.
4. Cashier indicates completion
of item entry.
6. Cashier tells the Customer
the total.

SYSTEM RESPONSE

3. Determines the item


price and adds the item
information to the
running sales transaction.
The
description
5. Calculates
andand
presents the
price
of the item are
sale total.
presented.

Expanded Use Case (3)


ACTOR ACTION

7. The Customer gives a cash


payment - possibly greater than
the sale total.
8. The Cashier records the cash
received amount.
10. The Cashier deposits the
cash received and extracts the
balance owing. Cashier gives
balance and receipt to
Customer.
12. Customer leaves with items
purchased.

SYSTEM RESPONSE

9. Show the balance due


back to the Customer.
Generates a receipt.
11. Logs the completed
sale.

Expanded Use Case (4)

Alternative Courses
Line 2: Invalid identifier entered. Indicate error
Line 7: Customer didnt have enough cash.
Cancel sales transaction
If a Typical Course of Events has multiple
equally likely courses of action
indicate branches in Use case
write a subsection for each branch indicating the
typical course of events
have alternatives for each subsection if necessary