last lecture chapter 1, 2, 3 and 4 applying uml and patterns -craig larman

40
Last lecture Chapter 1 , 2 , 3 and 4 Applying UML and Patterns -Craig Larman

Upload: abraham-baker

Post on 28-Dec-2015

245 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Last lecture

Chapter 1 , 2 , 3 and 4

Applying UML and Patterns

-Craig Larman

Page 2: 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.

Page 3: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

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.

Page 4: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

The Most Important Concept

Each iteration will include requirements,

analysis, design, and implementation.

Iterations are timeboxed.

Incremental : system grows over time

Page 5: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

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.

Page 6: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Rational Unified Process

ManagementEnvironment

Business Modeling

Implementation

Test

Analysis & Design

Preliminary Iteration(s)

Iter.#1

PhasesProcess Workflows

Iterations within phases

Supporting Workflows

Iter.#2

Iter.#n

Iter.#n+1

Iter.#n+2

Iter.#m

Iter.#m+1

Deployment

Configuration Mgmt

Requirements

Elaboration TransitionInception Construction

Page 7: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Iterations

Page 8: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Another approach :Waterfall Model

Requirements

Design

Implementation

Test

All or most of the requirements are defined before development begins

Page 9: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Example Questions in InceptionAsk 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 …..

Page 10: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

10

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.

Page 11: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

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.

Page 12: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Any question before we go on with new topic?

Page 13: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Use Cases

Chapter 5 and 6

Applying UML and Patterns

-Craig Larman

Page 14: Last lecture Chapter 1, 2, 3 and 4 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

Page 15: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

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.

Page 16: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Use Case 1

Use caseText documents, not diagramsUse 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.

Page 17: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

The purpose of use cases

oUncover and describe all tasks that need doing in a

system (of both human and system actors)

oGive a clear and consistent description of what the

system should do.

oProvide a basis for performing tests that verify the

system delivers the functionality stated.

oTo analyse what functionality that need developing for

the system

Page 18: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Use cases documented in two ways Verbal description

oDescribes the content of each use case

oTypically uses a pre-defined template

Use Case diagrams

oGive an overview of visible use scenarios in the system

oDescribes what actors that interact with the system

oDescribes any linkages between use cases

Page 19: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

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.

Page 20: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Use case diagramBoundary of the system

(1)

Actor (2)

Use case(3)

Linkage between use cases(4)

Page 21: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Actors - stakeholders

Actor: external entity interacts (behavior) with system, such as a person (identified by role), computer system, or organization; for example, a cashier.

Page 22: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

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

Page 23: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

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 actors (stakeholders) ?

Page 24: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

How to find Use cases ?

Recommended procedure:•Choose the system boundary

•Find the primary actors

•Find the primary actor´s goals

•Define a use case for each

How?

•Ask: what are your goals?

Page 25: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Case Study

Page 26: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

How to find Use cases ?Stakeholders Goals Use case

Primary actor

•Receptionist

•Xxxxx

•Xxxxxx

•Xxxxxxx

•Head waiter

•xxxxxxxxx

To be able to record booking

To be able to cancel booking

To be able to record arrival

To be able to make table transfer

Record Booking

Cancel Booking

Record Arrival

Transfer table

Supporting actors

•Tax calculator

•Yyyyyyyy

Offstage actor

•Sale tax agency

•Zzzzzz

Page 27: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

04/19/23 CPSC-4360-01, CPSC-5360-01, Lecture 3

27

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.

Page 28: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

04/19/23 CPSC-4360-01, CPSC-5360-01, Lecture 3

28

Other Use Case Description Template

1. Receptionist enters date of requested reservation;

3. there is a suitable table available: Receptionist enters details (customer’s name, phone number, time of booking, number of covers, table number);

2. System displays bookings for that date.

4. System records and displays new booking.

Actor System

Page 29: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

04/19/23 CPSC-4360-01, CPSC-5360-01, Lecture 3

29

Alternative path

Alternative flows, if no table is available

UC1 : Record Booking – No Table Available:

Alternative path

1 Receptionist enters date;

2 System displays bookings;

3 no table available: end of use case.

Page 30: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Detailled verbal description

Page 31: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

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?

Page 32: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

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.

Page 33: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Detailled Use Case Examples

Page 34: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Use case #1 : Add Book

Primary actor : LibrarianDescription : Create a new book in libraryPre-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.

Page 35: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

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.

Page 36: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Use case #2 : Search BookPrimary actor : LibrarianDescription : search book based on title or authorPre-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.

Page 37: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Use case #2 : Search Book

Page 38: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

Use case: book work-shop

Primary actor : UnemployedDescription : Record booking transactions and satisfy the unemployed´s interests.Precondition : no specific pre-conditionsPostcondition : work-shops are allocated to the customer 1.Unemployed enter : www.ABC.dk2.Unemployed enters the period , work-shop type and click search3.System display a list of work-shops4.Unemployed click on the work-shop link to read its detail 5.System display work-shop details6.Unemployed clicks “book button”  Step 4, 5 and 6 are repeated as long as the unemployed wants to participate to a work-shop 7.System display payment form8.Customer enter his details and his billing info and click submit.9.System validates billing info and display the result 

Use case #3 : register Unemployed

Page 39: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

What we did so far ?

Operation: enterItem(…)

Post-conditions:- . . .

Operation Contracts

Sale

date. . .

SalesLineItem

quantity

1..*1 . . .

. . .

Domain Model

Use-Case Model

Design Model: Register

enterItem(itemID, quantity)

: ProductCatalog

spec = getProductSpec( itemID )

addLineItem( spec, quantity )

: Sale

objects, attributes, associations

Require-ments

Business Modeling

Design

Sample UP Artifact Relationships

: System

enterItem(id, quantity)

Use Case Text

System Sequence Diagrams

makeNewSale()

system events

Cashier

Process Sale

: Cashier

use case

names

system operations

Use Case Diagram

Vision

SupplementarySpecification

Glossary

scope, goals, actors, features

terms, attributes, validation

non-functional reqs, quality attributes

requirements

Process Sale

1. Customer arrives ...2. Cashier makes new sale.3. ...

Page 40: Last lecture Chapter 1, 2, 3 and 4 Applying UML and Patterns -Craig Larman

04/19/23 CPSC-4360-01, CPSC-5360-01, Lecture 3

40

Thank you for your attention!

Questions?