Object Oriented Analysis and Design

Download Report

Transcript Object Oriented Analysis and Design

Last lecture
Chapter 1 , 2 , 3 and 4
Applying UML and Patterns
-Craig Larman
The Unified Process


A standardized approach to analysis
and design helps to ensure that all
necessary tasks are understood and
completed in software development.
The course, will focus on the Unified
Process developed at Rational Software
by Ivar Jacobsen, Grady Boch, Jim
Rumbaugh, and others.
Applying UML


UML is just a standard diagramming
notation. It is just a tool.
Knowing UML helps you communicate
with others in creating software
NB: Goal of this class:
•
Learning Object-Oriented Analysis and
Design, not how to draw diagrams.
The Most Important Concept

Each iteration will include requirements,
analysis, design, and implementation.

Iterations are timeboxed.

Incremental : system grows over time
Example: Building a House


Incremental: Start with a modest
house, keep adding rooms and
upgrades to it.
Iterative: On each iteration, the
house is re-designed and built a new.
Rational Unified Process
Phases
Process Workflows
Inception Elaboration
Construction
Transition
Business Modeling
Requirements
Analysis & Design
Implementation
Test
Deployment
Supporting Workflows
Configuration Mgmt
Management
Environment
Preliminary Iter. Iter. Iter. Iter. Iter.
Iteration(s) #1
#2
#n
#n+1 #n+2
Iter. Iter.
#m #m+1
Iterations within phases
Iterations
Another approach :Waterfall Model
All or most of the requirements
are defined before
development begins
Requirements
Design
Implementation
Test
Example Questions in Inception
Ask questions such as:
• What is the vision and business case for this project?
• Feasible?
• Buy and/or build?
• Buy components and glue them together or from
scratch?
• Estimate potential risks
• Rough estimate of cost: Is it $10K-100K or in the
millions?
• Should we proceed or stop?
If the answer is YES …..
What Artifacts (documents or model) may
start in Inception?
• Vision and Business Case: describes the high-level
goals and constraints, provides an executive summary;
• Use Case Model (chap 6 Today): describes the
fundamental requirements: during inception identify
the names of the use cases and analyse perhaps 10%
of the them;
• Supplementary specification (chap 7 Today ):
describe non-functional requirements, look-and-feel,
atmosphere etc.
10
What artifacts (documents or model) may
start in Inception?
• Glossary (Chap 7 today): keeping track to key terms;
• Risk list and risk management plan: describe the risks
•
(business, technical, resource, schedule) and ideas for their
mitigation;
Prototypes and proof-of-concepts: to clarify the vision,
and validate technical ideas;
• Iteration Plan : Describes what to do in the first elaboration
iteration, and overall goals of the elaboration phase;
IMPORTANT :
Artifacts will be partial at this stage. Will be refined in later iterations.
Any question before we go
on with new topic?
Use Cases
Chapter 5 and 6
Applying UML and Patterns
-Craig Larman
Program for today






What is a Use case?
How find stakeholders ?
Find Use cases
Prioritize Use Cases
Detailled Use cases
Organize the use case Model
Use Cases


Use cases are stories (scenarios) of how actors
use (interact with) the system to fulfill his goal.
Use cases are ‘tasks’ done by the system and has
observable value to the actor
• Process sale
• Place Order
• Loan book

A full description of a use case includes:
 a basic course of events;
 a number of alternative and exceptional courses.
Use Case
 Use
1
case
Text
documents, not diagrams
Use case modeling is writing text, not drawing
diagrams.
Nothing object-oriented about use cases;
Use cases are a key requirements input to classic
OOA/D.
Functional requirements that indicate what the
system will do.
The purpose of use cases
o Uncover and describe all tasks that need doing in a
system (of both human and system actors)
o Give a clear and consistent description of what the
system should do.
o Provide a basis for performing tests that verify the
system delivers the functionality stated.
o To analyse what functionality that need developing for
the system
Use cases documented in two ways

Verbal description
o Describes the content of each use case
o Typically uses a pre-defined template

Use Case diagrams
o Give an overview of visible use scenarios
in the system
o Describes what actors that interact with
the system
o Describes any linkages between use cases
Use Case Formats (verbal description)
•
•
•
Brief
• Terse one-paragraph summary, usually the main success
scenario.
• During early requirements analysis
Casual
• Informal, multiple paragraphs that cover various scenarios.
• During early requirements analysis
Fully dressed
• The most elaborate. All steps and variations are written in
detail and there are supporting sections with preconditions
etc.
Use case diagram
Boundary of the system
(1)
Actor
(2)
Use case
(3)
Linkage
between
use cases
(4)
Actors - stakeholders
 Actor:
external entity interacts (behavior) with
system, such as a person (identified by role),
computer system, or organization; for example,
a cashier.
Actors - stakeholders

Three kind of Actors - Stakeholders
 Primary actor has user goals fulfilled through using services.
(e.g., the cashier).
 Supporting
actor provides a service (e.g., the automated
payment authorization service is an example). Often a
computer system, but could be an organization or person
(external interfaces)
(e.g. : tax calculation )
 Offstage actor has an interest in the behavior of the use case,
but is not primary or supporting (e.g., a government tax
agency).
How to find actors (stakeholders) ?
Who will use the system?
Good Habits: keep a few individuals (two or three) in mind and
make sure that the actors you identify cover their needs.
Usefull questions to have in mind :
•Who will supply, use, or remove information?
•Who will use this functionality?
•Who is interested in a certain requirement?
•Where in the organization is the system used?
•Who will support and maintain the system?
•What are the system's external resources?
•What other systems will need to interact with this one?
How to find Use cases ?

Recommended procedure:

How?
• Choose the system boundary
• Find the primary actors
• Find the primary actor´s goals
• Define a use case for each
• Ask: what are your goals?
Case Study
How to find Use cases ?
Stakeholders
Goals
Use case
Primary actor
To be able to record booking
To be able to cancel booking
Record Booking
Cancel Booking
To be able to record arrival
To be able to make table transfer
Record Arrival
Transfer table
•Receptionist
•Xxxxx
•Xxxxxx
•Xxxxxxx
•Head waiter
•xxxxxxxxx
Supporting actors
•Tax calculator
•Yyyyyyyy
Offstage actor
•Sale tax agency
•Zzzzzz
Basic (normal/happy)path
UC1 : Record Booking
 Receptionist enters date of requested reservation;
 System displays bookings for that date;
 There is a suitable table available: Receptionist enters
details (customer’s name, phone number, time of
booking, number of covers, table number);
 System records and displays new booking.
7/18/2015
CPSC-4360-01, CPSC-5360-01,
Lecture 3
27
Other Use Case Description Template
Actor
System
1. Receptionist enters date
2. System displays bookings
of requested reservation;
for that date.
3. there is a suitable table
4. System records and
available: Receptionist
displays new booking.
enters details (customer’s
name, phone number,
time of booking, number
of covers, table number);
7/18/2015
CPSC-4360-01, CPSC-5360-01,
Lecture 3
28
Alternative path

Alternative flows, if no table is available
UC1 : Record Booking – No Table Available:
Alternative path
1
2
3
Receptionist enters date;
System displays bookings;
no table available: end of use case.
7/18/2015
CPSC-4360-01, CPSC-5360-01,
Lecture 3
29
Detailled verbal description
Use Case - verbal description

There is no standardised notation for how a use case is described,
verbally

The description typically includes:
•
•
•
•
•
•
•
•
Use Case name (use imperative verbs! e.g . Process Sale)
Purpose
Actors
Start conditions : What needs to be done for the use case to
begin?
Description of the use case steps
What does the actor do ? How does the system react?
Any exceptions
Any variants
End conditions (result) : What is the result of the use case?
Preconditions and Postconditions
Example:
A precondition for the use case Cash Withdrawal in the ATM
machine:
The customer has a personally-issued card that fits in
the card reader, has been issued a PIN number, and is
registered with the banking system.Balance is +
A postcondition for the use case Cash Withdrawal in the ATM
machine:
At the end of the use case, all account and transaction
logs are balanced, communication with the banking
system is reinitialized and the customer has
withdrawn cash and been returned his card.
Detailled Use Case Examples
Use case #1 : Add Book
Primary actor : Librarian
Description : Create a new book in library
Pre-conditions : Library logged in.
Post-condition : new book is added to the library system
Basic Course:
1. The use case begins when the librarian wants to add new books
2. The system display the ”create book” form
3. The librarian enters book details (ISBN nr, Title, Author, Publication
year , publisher and genre) and clicks on the ”create” button.
Use case #1 : Add Book
4. The new book is created and added to the book list
steps 2 ,3 and 4 are repeated as long as the librarian wants to add more
books.
5. The system displays the list of books and the use case ends.
Alternate Course A : ISBN already exists
A.5 . The system asks the user to enter a valid ISBN
A.6 The new book is created and added to the book list
A.7 The system displays the list of books and the use case ends.
Use case #2 : Search Book
Primary actor : Librarian
Description : search book based on title or author
Pre-conditions : Book exists in the library.
Post-condition : Book is found
Basic Course:
1. The use case begins when the librarian wants to search a book
2. The system display the ”search book” screen.
3. The librarian enters book title/author and clicks on the ”search”
button.
Use case #2 : Search Book
4. The system search for the book and displays the list of found
books , then the use case ends.
Alternate Course A : No book of this title exists
What to do ?
Use case #3 : register Unemployed
Use case: book work-shop
Primary actor : Unemployed
Description : Record booking transactions and satisfy the unemployed´s interests.
Precondition : no specific pre-conditions
Postcondition : work-shops are allocated to the customer
1.
2.
3.
4.
5.
6.
Unemployed enter : www.ABC.dk
Unemployed enters the period , work-shop type and click search
System display a list of work-shops
Unemployed click on the work-shop link to read its detail
System display work-shop details
Unemployed clicks “book button”
Step 4, 5 and 6 are repeated as long as the unemployed wants to participate to a workshop
7. System display payment form
8. Customer enter his details and his billing info and click submit.
9. System validates billing info and display the result
What we did so far ?
S a m p le U P A r t if a c t R e la t io n s h ip s
D o m a in M o d e l
S a le
B u s in e s s
M o d e lin g
1 .. *
1
d a te
. . .
S a le s
L in e Ite m
. . .
. . .
q u a n tity
o b je c ts , a ttr ib u te s ,
a s s o c ia tio n s
s c o p e , g o a ls ,
a c to r s , fe a tu r e s
U s e -C a s e M o d e l
V is io n
P r o c e s s S a le
P ro c e s s
S a le
use
case
nam es
C a s h ie r
R e q u ir e m e n ts
U s e C a s e D ia g r a m
1 . C u s to m e r
a r r iv e s ...
2 . C a s h ie r
m akes new
s a le .
3 . ...
te r m s , a ttr ib u te s ,
v a lid a tio n
G lo s s a r y
U se C ase Text
s y s te m
e v e n ts
: S y s te m
O p e r a tio n :
e n te r Ite m ( … )
P o s t- c o n d itio n s :
- . . .
: C a s h ie r
s y s te m
o p e r a tio n s
m ake
N e w S a le ( )
S u p p le m e n ta r y
S p e c ific a tio n
e n te r Ite m
( id , q u a n tity )
n o n - fu n c tio n a l r e q s ,
q u a lity a ttr ib u te s
S y s te m S e q u e n c e D ia g r a m s
O p e r a t io n C o n t r a c t s
r e q u ir e m e n ts
: R e g is te r
D e s ig n
D e s ig n M o d e l
: P r o d u c tC a ta lo g
e n te r Ite m
(ite m ID , q u a n tity )
s p e c = g e tP r o d u c tS p e c ( ite m ID )
a d d L in e Ite m ( s p e c , q u a n tity )
: S a le
Thank you for your attention!
Questions?
7/18/2015
CPSC-4360-01, CPSC-5360-01,
Lecture 3
40