145
Topic 4: Object-Oriented Approach to Requirements Engineering Software Engineering Faculty of Computing Universiti Teknologi Malaysia

Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Embed Size (px)

Citation preview

Page 1: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Topic 4: Object-Oriented Approach to Requirements Engineering

Software EngineeringFaculty of Computing

Universiti Teknologi Malaysia

Page 2: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Topic Outline

• Part I: Requirements Document

– Software Requirements Specification (SRS)

• Part II: Requirements Modeling Concept

– Use Case Modeling and Specification

– System Sequence Diagram (SSD)

– Activity Diagram

– Domain Modeling

– Statechart Diagram

Software Engineering 2

Page 3: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

PART I

Requirements Document – Software Requirements Specification (SRS)

Software Engineering 3

Page 4: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Objective

• To understand how requirements may be organized in a software requirements document

• To adopt a standard in producing a requirements document

Software Engineering 4

Page 5: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

The Software Requirements Document

• Software requirements document is an officialstatement of what is required for thereference of software developers.

• Should include both a definition of userrequirements and a specification of thesystem requirements.

• It is NOT a design document. As far aspossible, it should set WHAT the systemshould do rather than HOW it should do it.

Software Engineering 5

Page 6: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

User and System RequirementsRecall

Software Engineering 6

Page 7: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Users of a Requirements Document

Software Engineering 7

Page 8: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Requirements Document Variability

• Information in requirements document dependson type of system and the approach used in itsdevelopment.

• Systems developed incrementally will, typically,have less detail in the requirements document.

• Requirements documents standards have beendesigned e.g. IEEE standard. These are mostlyapplicable to the requirements for large softwareprojects.

Software Engineering 8

Page 9: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

IEEE Std 830-1998

Software Engineering 9

Page 10: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

SRS Outline of IEEE Std 830-1998

See page 11 of IEEE Std 830-1998

Software Engineering 10

Page 11: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Example of Template for the Front Part of SRS Document

Software Engineering 11

Page 12: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Section 1: Introduction

Software Engineering 12

Page 13: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Section 2: Overall Description,Sub-Section 2.1

Software Engineering 13

Page 14: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Sub-sections 2.1.1 to 2.1.3

Software Engineering 14

Page 15: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Sub-sections 2.2 & 2.3

Software Engineering 15

Page 16: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Sub-sections 2.4 to 2.6

Software Engineering 16

Page 17: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Section 3: Specific Requirements

Software Engineering 17

Page 18: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

A.5 Template of SRS Section 3: Organized by Feature

• Section 3.1.1 to Section 3.1.4 provide the details of what described in 2.1.2 to 2.1.5. Consider to organize Section 3.2 by the modules i.e. map each feature with each module and map respective use case in the module with its functional requirement. For each functional requirement, indicate its details using use case description. Include sequence diagram (of system level also known as system sequence diagram) and activity diagram for each use case i.e. functional requirement.

Software Engineering 18

Page 19: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Key Points

• The software requirements document is an agreed statement of the system requirements.

• It should be organized so that both system customers or users and software developerscan use it.

Software Engineering 19

Page 20: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

PART II

Requirements Modeling Concept

Reference: Satzinger et al. (2011)

Software Engineering 20

Page 21: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Requirements Models: Traditional Approach vs. Object-Oriented Approach

Software Engineering 21

Page 22: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Overview of Models Used in Requirements and Design

• Logical models specify processes

• Physical models are based on logical models

– Implement some component of the system

– Included within the design discipline

• UML diagrams are used in system development

• Additional models also used

Software Engineering 22

Page 23: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

UML Diagrams used for Modeling

Software Engineering 23

Page 24: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Additional Models used for Requirements and Design Disciplines

Software Engineering 24

Page 25: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

ROCKY MOUNTAIN OUTFITTERS (RMO)

Case Study 1

Software Engineering 25

Page 26: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Rocky Mountain Outfitters and Its Strategic Information Systems Plan

• RMO serves role of case study for text

• Business: manufacture and distribute sports clothing

• Project: develop new customer support system

• Initial activities– Understand the nature of the business

– Investigate current information system

– Define basic objectives of customer support system

– Develop the information systems strategic plan

Software Engineering 26

Page 27: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Early RMO Catalog Cover (Spring 1978)

Software Engineering 27

Page 28: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Introducing Rocky Mountain Outfitters (RMO)

• RMO founded by John and Liz Blankens in 1978

• Staff consists of 600 people

• Annual sales have risen to nearly $100 million

– Mail-order operation contributes $60 million

– In-store retail sales account for $7.5 million

– Phone-order operation accounts for $30 million

Software Engineering 28

Page 29: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Current RMO Catalog (Spring 2006)

Software Engineering 29

Page 30: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

RMO Strategic Issues

• Founders commit to business expansion in 2002

• Growth channel: business-to-consumer (B2C) e-commerce

• Two key strategic thrusts support five year plan:

– Supply chain management (SCM)

– Customer relationship management (CRM)

• Object-oriented technology and techniques shape system development projects

Software Engineering 30

Page 31: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

RMO’s Organizational Structure and Locations

• John and Liz Blankens are chief executives

• 113 workers employed in Park City, Utah

• Two retail store locations: Park City and Denver

• Manufacturing facilities in Salt Lake City and Portland, Oregon

Software Engineering 31

Page 32: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Rocky Mountain Outfitters’ Organizational Structure

Software Engineering 32

Page 33: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

RMO’s Organizational Structure and Locations (continued)

• Three distribution/warehouse facilities: Salt Lake City, Albuquerque, and Portland

• Mail-order processing in Provo, Utah

• Phone-sales center in Salt Lake City

Software Engineering 33

Page 34: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Rocky Mountain Outfitter’s Locations

Software Engineering 34

Page 35: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

The RMO Information Systems Department

• 50 employees in information systems department

• Mac Preston: chief information officer (CIO)

• Information system organization

– System support: telecommunications, database administration, operations, and user support

– System development team: four project managers, six systems analysts, ten programmer analysts, and support staff

Software Engineering 35

Page 36: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

RMO Information Systems Department Staffing

Software Engineering 36

Page 37: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Existing RMO Systems

• Data center in Park City supports (8) systems:– Merchandising/Distribution

– Mail Order

– Phone Order

– Retail Store Systems

– Office Systems

– Human Resources

– Accounting/Finance

– RMO Informational Web site

Software Engineering 37

Page 38: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

The Information Systems Strategic Plan

• SCM and CRM provide vision for the plan

• Two chief components

– Technology Architecture Plan: emphasize distributed computing

– Application Architecture Plan: seamlessly integrate replacements, upgrades and new packages

• Timetable reflects implementation schedule

Software Engineering 38

Page 39: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

The Timetable for RMO’s Application Architecture Plan

Software Engineering 39

Page 40: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

The Customer Support System

• Development project: customer support system (CSS)

• RMO core competency: cultivating customer loyalty

• Application architecture plan specifies CSS objectives

– Includes functions associated with providing products

– Supports customer relationship management strategy

– Offers multiple sales channels: telephone, mail, retail, and Internet

• System details worked out in requirements analysis

Software Engineering 40

Page 41: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

USE CASE AND DOMAIN MODEL

Software Engineering 41

Page 42: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Objectives

• To define requirements using use cases and problem domain classes

• To identify and analyze events and resulting use cases, for use case diagram

• To identify and analyze domain classes for domain model class diagram

• To produce detail requirements using system sequence diagram, activity diagram and statechart diagram

Software Engineering 42

Page 43: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Ways of Writing a System Requirements Specification

Notation Description

Natural language The requirements are written using numbered sentences in natural

language. Each sentence should express one requirement.

Structured natural

language

The requirements are written in natural language on a standard form or

template. Each field provides information about an aspect of the

requirement.

Design description

language

This approach uses a language like a programming language, but with

more abstract features to specify the requirements by defining an

operational model of the system. This approach is now rarely used

although it can be useful for interface specifications.

Graphical notations Graphical models, supplemented by text annotations, are used to define

the functional requirements for the system; UML use case and

sequence diagrams are commonly used.

Mathematical specifications These notations are based on mathematical concepts such as finite-

state machines or sets. Although these unambiguous specifications can

reduce the ambiguity in a requirements document, most customers don’t

understand a formal specification. They cannot check that it represents

what they want and are reluctant to accept it as a system contract.

Recall

Software Engineering 43

Page 44: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Events and Use Cases

• Use case

– Activity the system carries out

– Entry point into the modeling process

• Event decomposition: help identify use cases

• Elementary business processes (EBPs)

– Basic unit of analysis

– Initiated by event occurring at specific time and place

– Discrete system response that adds business value

Software Engineering 44

Page 45: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Identify Use Cases: User vs. Goal

Software Engineering 45

Page 46: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Types of Events

• External Events

– Occur outside the system

– Usually caused by external agent

• Temporal Events

– Occurs when system reaches a point (deadline) in time

• State Events

– Asynchronous events responding to system trigger

Software Engineering 46

Page 47: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Identifying Events

• Distinguish events from prior conditions

– Can the transaction complete without interruption?

– Is the system waiting for next transaction?

• Trace sequence of events initiated by external agent such as those in activity diagram

– Isolate events that actually touch the system

Software Engineering 47

Page 48: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Events in the Rocky Mountain Outfitters Case

• Developing list of external events

– Identify all people and organizational units that want something from the system

• Developing list of temporal events

– Identify regular reports and statements that system must produce at certain times

Software Engineering 48

Page 49: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

External Events for the RMO Customer Support System

Software Engineering 49

Page 50: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Temporal Events for the RMO Customer Support System

Software Engineering 50

Page 51: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Looking at Each Event and the Resulting Use Case

• Enter use cases in an event table

• Event table includes rows and columns

– Each row is a record linking an event to a use case

– Columns represent key information

• RMO event table anatomizes customer support system

Software Engineering 51

Page 52: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Information about each Event and the Resulting Use Case in an Event Table

Software Engineering 52

Page 53: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

The Complete Event Table for the RMO Customer Support System

Software Engineering 53

Page 54: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Problem Domain Classes

• Problem domain

– Set of work-related “things” in system component

• Things have data representation within system

– Examples: products, orders, invoices, customers

• OO approach to things in problem domain

– Objects that interact in the system

• Identify and understand things in problem domain

– Key initial steps in defining requirements

Software Engineering 54

Page 55: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Types of Things

• Things can be identified with methodology

• Separate the tangible from the intangible

• Include information from all types of users

• Ask important questions about nature of event

– “What actions upon things should be acknowledged and recorded by the system?”

• Example case: customer placing an order

Software Engineering 55

Page 56: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Type of Things: Example

Software Engineering 56

Page 57: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Procedure for Developing an Initial List of Things

• List nouns that users mention when discussing system

• Event table as source of potential things

– Use cases, external agents, triggers, response

• Select nouns with questions concerning relevance

– Further research may be needed

Software Engineering 57

Page 58: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Partial List of “Things” Based on Nouns for RMO

Software Engineering 58

Page 59: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Partial List of “Things” Based on Nouns for RMO

Software Engineering 59

Page 60: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Partial List of “Things” Based on Nouns for RMO

Software Engineering 60

Page 61: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Associations among Things

• Analyst document entity associations (relationships)– Example: “is placed by” and “works in”

• Associations apply in two directions– Customer places an order (better to use active voice)– An order is placed by a customer (passive voice – not

encouraged to be used

• Multiplicity: the number of associations – One to one or one to many

• The associations between types of things– Unary (recursive), binary, n-ary

Software Engineering 61

Page 62: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Attributes of Things

• Specific details of things are called attributes

• Analyst should identify attributes of things

• Identifier (key): attribute uniquely identifying thing

– Examples: Social Security number, vehicle ID number, or product ID number

• Compound attribute is a set of related attributes

– Example: multiple names for the same customer

Software Engineering 62

Page 63: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Attributes and Values

Software Engineering 63

Page 64: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Classes and Objects

• Domain model class diagram as UML class

– OOA applies domain model class diagram to things

• Problem domain objects have attributes

• Software objects encapsulate attributes and behaviors

– Behavior: action that the object processes itself

• Software objects communicate with messages

• Information system is a set of interacting objects

Software Engineering 64

Page 65: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Objects Encapsulate Attributes and Methods

Software Engineering 65

Page 66: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Domain Model Class Diagram Notation

• Class diagram key– General class symbol: rectangle with three

sections– Sections convey name, attributes, and

behaviors – Methods (behaviors) not shown in domain

model class diagram– Lines connecting rectangles show associations– Multiplicity reflected above connecting lines

• Domain class objects reflect business concern, policies, and constraints

Software Engineering 66

Page 67: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Class Symbol

Class Name

Attribute

Behavior/Method/Operation

Do not include this part in

analysis stage –only in design

stage

Software Engineering 67

Page 68: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Class Symbol with Name and Attributes: Example

Software Engineering 68

Page 69: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

A Simple Domain Model Class Diagram

Software Engineering 69

Page 70: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Multiplicity of Associations

Recall the knowledge

gained from the database course

and SADM

Software Engineering 70

Page 71: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

A University Course Enrollment Domain Model Class Diagram with a Many-to-Many Association

Software Engineering 71

Page 72: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

A Refined University Course Enrollment Domain Model Class Diagram with an Association Class

Software Engineering 72

Page 73: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Hierarchies in Class Diagram Notation

• Generalization/specialization notation

– Inheritance hierarchy

– Rank things the more general to the more special

• Motor vehicle class includes trucks, cars, buses

• Classification: means of defining classes of things

– Superclass: generalization of a class

– Subclass: specialization of a class

Software Engineering 73

Page 74: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Hierarchies in Class Diagram Notation (continued)

• Whole-part Hierarchy Notation– “The whole is equal to the sum of the parts”

• Two types of whole-part hierarchies– Aggregation: association with independent parts

(collection of)• Example: keyboard is part of computer system

– Composition: association with dependent part (composed of)• Example: CRT and monitor

• Multiplicity applies to whole-part relationships

Software Engineering 74

Page 75: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Hierarchies in Class Diagram Notation (continued)

• Design Class Diagrams (in design phase)– Models classes into precise software analogs

– Includes domain class information plus methods

– Triangle symbol between classes indicates inheritance

– Properties of attributes are shown with curly braces

• Class fundamentals– Instances of a class (objects) manage their own data

– Abstract classes are not instantiated (created)

– Subclasses inherit attributes/behaviors from superclass

Software Engineering 75

Page 76: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

A Generalization/Specialization Hierarchy for Motor Vehicles

Software Engineering 76

Page 77: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

A Generalization/Specialization Hierarchy for Orders

Software Engineering 77

Page 78: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Whole-Part (Aggregation) Relationships Between a Computer and Its Parts

Software Engineering 78

Page 79: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Domain Model Class Diagram vs Design Class Diagram

Include method

Software Engineering 79

Page 80: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

RMO Domain Class Diagram

• Derives from noun list

• RMO domain class diagram shows attribute

• Models do not show methods

• Problem domain classes reflect high-level view of RMO use cases

Software Engineering 80

Page 81: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Rocky Mountain Outfitters Domain Model Class Diagram

Software Engineering 81

Page 82: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

DETAILED REQUIREMENTS

Use Case Diagram, Activity Diagram, System Sequence Diagram, State Charts for State Machine Diagram

Software Engineering 82

Page 83: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Detailed Object-Oriented (OO) Requirements Definitions

• System requirements captured with OO models

• “Divide and conquer” strategy toward complexity

• Two subsets of OO modeling approach

– Use case driven extending four specific models

• Use case diagrams, use case descriptions, activity diagrams, system sequence diagrams

– Object driven extending statechart diagram

Software Engineering 83

Page 84: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Requirements Diagrams With UML Models

Software Engineering 84

Page 85: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Detailed OO Requirements Definitions(continued)

• Use case diagram: table of contents for business events

• System sequence diagrams (SSDs)– Define and order sequence of inputs and outputs – Information flows referred to as messages

• Class diagrams – Identify real-world “things” – Determine the structure of the programming classes

• Statechart diagram describes collection of object states

Software Engineering 85

Page 86: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

System Processes: A Use Case/ Scenario View

• Define use cases into two tiers:

– Overview level derived from:

• Event table and use case diagrams

– Detailed level derived from combination of:

• Use case description

• Activity diagram

• Sequence diagram

Software Engineering 86

Page 87: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Use Cases and Actors

• Source– Person or thing initiating the business event who

may/may not touch the system– Must be external to the system

• Actor– Person or thing that touches the system – Lies outside of automation boundary

• Identifying actors at the right level of detail– Assume actors (even non-human types) have

hands– Use case is a goal that the actor wants to achieve

Software Engineering 87

Page 88: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

The Use Case Diagram

• Notation for use case diagrams

– Simple stick figure represents an actor

– Actor’s hands indicate direct system access

– Use case itself symbolized by an oval

– Connecting lines match actors to use cases

• Actors may also be other system interfaces

– May be represented with stick figure or rectangle

Software Engineering 88

Page 89: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

A Simple Use Case with an Actor

Software Engineering 89

Page 90: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Automation Boundary and Organization

• Expand use case diagrams with other actors and use cases

• Relationship line: allows each actor to interact with each use case

• Automation boundary

– Line drawn around the entire set of use cases

– Defines interface between actors and computer system

Software Engineering 90

Page 91: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Use Case Diagram of Order-Entry Subsystem for RMO with a System Boundary

Software Engineering 91

Page 92: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

All Uses Cases Involving the Customer Actor

Software Engineering 92

Page 93: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

A Use Case Diagram of the Customer Support System (by Subsystem)

Note: If possible DO NOT duplicate the same actors e.g. clerk, customer, management (see arrows)

For a large system, the modularity is organized by sub-systems. However, for a medium to small size system, consider creating modules.

Software Engineering 93

Page 94: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

« Includes » Relationships

• «includes» or «uses» relationship– Use case calling services of common subroutine

– Common subroutine itself becomes additional use case

• Examples: “Validate customer account” and “Look Up Item Availability”

• Notation – Relationship denoted by connecting line with arrow

– Direction of the arrow indicates major/minor cases

Software Engineering 94

Page 95: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

An Example of Order-Entry Subsystem with <<includes>> Use Cases

Software Engineering 95

Page 96: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

The <<extend>> Relationships

2016 Software Engineering 96

<<extend>> relationships model exceptional or seldom invoked cases

The exceptional event flows are factored out of the main event flow for clarity

The direction of an <<extend>> relationship is to the extended use case

Use cases representing exceptional flows can extend more than one use case

Page 97: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Developing a Use Case Diagram

• Two ways to identify additional use cases

– Divide one large use case into two

– Define another use case based on a common subroutine

• Distinguish between temporal and state events

• Iterative process translates business events to use cases

– Identify the actors and roles for each use case

– Extract system response to business events

• Data of system stabilizes after completion of the goal

Software Engineering 97

Page 98: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Use Case Detailed Descriptions

• Use cases have internal complexity

– Sequence of steps to execute business process

– Several variations may exist within single use case

• Valid variation known as scenario

– Example: “Create new order” varies from phone to Internet order

• Work with variety of diagrams and descriptions for each use case

Software Engineering 98

Page 99: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Use Case Detailed Descriptions (continued)

• Use case descriptions written at (3) levels of detail

– Brief description

• Summary statement conjoined to activity diagram

– Intermediate description

• Expands brief description with internal flow of activities

– Fully Developed Description

• Expands intermediate description for richer view

Software Engineering 99

Page 100: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Brief Description of Create New Order Use Case

Software Engineering 100

Page 101: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Intermediate Description of Telephone Order Scenario for Create New Order Use Case

Software Engineering 101

Page 102: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Use Case Detailed Descriptions (continued)

• Fully developed use case description

– Superset of intermediate and brief descriptions

– Consists of eleven compartments

– User, actor, stakeholder, EBP, and conditions identified

• Activity Diagram Description

– Document the workflows of business processes

– Document flow of activities for use case scenarios

– Form basis of system sequence diagrams (SSDs)

Software Engineering 102

Page 103: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Use Case Description and Functional Decomposition

Functional decomposition: breaking down aproblem into small, isolated parts

• The parts work together to provide thefunctionality of the system

• Often do not make sense in isolation

• Use cases are NOT functional decomposition

• Keep the functionality together to describe acomplete use of the system

2016 Software Engineering 103

Page 104: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Bad Example: Use Case with Functional Decomposition

2016 Software Engineering 104

Avoid FD:-Very small use cases-Too many use cases-Use cases with no result or value-Names with low-level operationi.e. function+data Insert Card

Page 105: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Good Example: UCD Without Functional Decomposition

2016 Software Engineering 105

Page 106: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Note: 1 Use Case must have at least 1 scenario or normal flow.Software Engineering 106

Page 107: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Fully Developed Use Case Description of Telephone Order Scenario for Create New Order

11 compartments

Software Engineering 107

Page 108: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Activity Diagram of Telephone Order vs. Web Order Scenario

Software Engineering 108

Page 109: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Identifying Inputs and Outputs: System Sequence Diagram

• System sequence diagram (SSD)

– Describes flow of information

– Identifies interaction between actors and system

– Message oriented

Software Engineering 109

Page 110: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

SSD Notation

• Actor “interacts” with the system via input/output

• SSDs use object notation– Box (rectangle) refers to individual object

– Name of the object underlined

– Messages sent/received by objects, not classes

• Lifeline– Extension of object or actor for duration of the SSD

– Indicates sequence of the messages sent/received

Software Engineering 110

Page 111: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Sample System Sequence Diagram (SSD)

Software Engineering 111

Page 112: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

SSD Notation (continued)

• Message syntax can take several forms

– Depends on send/return direction

• Message semantics: actions (like commands) invoked on destination object

• Complete message notation:*[true/false condition] return-value := message-name (parameter-list)

Software Engineering 112

Page 113: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Repeating message (a)Detailed notation, (b) Alternate notation

Software Engineering 113

Page 114: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Developing a System Sequence Diagram

• Begin with detailed description of use case– Fully developed form

– Activity diagrams

• 4-step process for turning activity diagram into SSD – Identify the input messages

– Describe messages from external actor to system

– Identify/apply special conditions to input messages

– Identify and add the output return messages

Software Engineering 114

Page 115: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

A Simplified Activity Diagram of Telephone Order Scenario

Software Engineering 115

Page 116: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Developing a System Sequence Diagram (continued)

• Names of messages reflect services performed

• Important principle for identifying data parameters– Base the list on the class diagram

– Attributes from the classes listed as parameters

• Iteratively define input/output parameters around workflows

• Objective: discovery and understanding

Software Engineering 116

Page 117: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

SSD of Simplified Telephone Order Scenario for Create New Order Use Case

Parameter

Software Engineering 117

Page 118: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

SSD of Web Order Scenario for Create New Order Use Case

Software Engineering 118

Page 119: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Agent Actor

ActivityInput

message

Parameter

Direction

Note: Observe the link between activity diagram with SSD

Software Engineering 119

Page 120: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

A Simple Activity Diagram to Demonstrate a Workflow

Agent

Swimlane

Activity

Direction

Decision symbol

Software Engineering 120

Page 121: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

An Activity Diagram Showing Concurrent Paths

Syncronizationbar

Software Engineering 121

Page 122: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Rocky Mountain Outfitters Domain Model Class Diagram

Note: Parameters in SDD correspond to attributes in relevant classes

1

2

3

1

2

3

3 3

3

Software Engineering 122

Page 123: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

State Chart or State Machine Diagram

• In OO approaches, state chart is drawn for a single class toshow the lifetime behavior of a single object.

• State chart is also known as state machine diagram.• State:

– a condition during the life of an object when it satisfiessome conditions, performs some actions, or waits for anevent

– It is found by examining the attributes and links defined forthe object

– represented as a rectangle with rounded corners• Transition

– represents a change of the internal condition/state of anobject

2016 Software Engineering 123

Page 124: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Identifying the Object Behavior: State Chart Diagram

• In brief, a state in a state chart similar to status condition– Spans many business events

– Developed for complex problem domain classes

• State chart/state machine diagram – Composed of ovals representing status of object

– Arrows represent transitions

Software Engineering 124

Page 125: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Transition Notation

i. Event: Single event that triggers a potential change of state i.e. from State-A to

State-B.ii. Guard condition:

Guard is a Boolean condition (true/false). It must be true for the transitionto be taken.

Optional: If missing, it indicates that the transition always occurs if eventoccurs.

iii. Effect: Behaviors that is executed during the transition. May include operation calls, the creation or destruction of another objects,

or the sending of a signal to an object. Optional: if missing, it indicates nothing is done during the transaction

2016 Software Engineering 125

State-A State-BEvent (arguments) [condition] / effect

Page 126: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Simple State Machine Diagram for a Printer

Software Engineering 126

Page 127: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Identifying the Object Behavior: State chart (continued)

• Guidelines to help identify states– Check naming convention for status conditions

– Simple states reflect simple conditions such as “On”

– Complex states labeled with gerunds or verb phrases • Example: “Being shipped”

– Active states usually not labeled with nouns

– Describe only states of being of the object itself

– Status conditions reported to management/customers • Example: “Shipped”

Software Engineering 127

Page 128: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Nested States And Concurrency

• Concurrency: condition of being in more than one state at a time

• Two modes of representation

– Use synchronization bars and concurrent paths

– Nest low-level states inside higher-level states

• Higher-level states also called composite states

– Complex structure of sets of states and transitions

– Represent a higher level of abstraction

Software Engineering 128

Page 129: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Sample Composite States for Printer Object

Software Engineering 129

Page 130: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Concurrent Paths for a Printer in Onstate

Software Engineering 130

Page 131: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Rules for Developing State Charts

1. Select the classes that will require statecharts

2. List all the status conditions for each group

3. Specify transitions that cause object to leave the identified state

4. Sequence state-transition combinations in correct order

5. Identify concurrent paths (if any)

6. Look for additional transitions

7. Expand each transition as appropriate

8. Review and test each statechart

Software Engineering 131

Page 132: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Developing RMO State Charts

• Review the domain class diagram

• Select classes with status conditions that need to be tracked

• Candidates: Order, OrderItem, InventoryItem, Shipment, Customer

• Choose Order and OrderItem

– Simplicity

– Location in the class hierarchy

Software Engineering 132

Page 133: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Software Engineering 133

Page 134: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Developing The Order Item State Chart

• Identify possible status conditions of interest

– “Ready to be shipped”

– “On back order”

– “Shipped”

• Continue developing statechart according to eight rules

Software Engineering 134

Page 135: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

States and Exit Transitions for OrderItem

Software Engineering 135

Page 136: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Partial State Machine Diagram for OrderItem

Software Engineering 136

Page 137: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Final State Machine Diagram for OrderItem

Software Engineering 137

Page 138: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Developing the Order State Chart

• States mirror the life cycle of an order

• Application of rules leads to greater complexity– Concurrent states

– New transitions

• Benefits of developing a statechart for an object– Captures and clarifies business rules

– Gain true understanding of system requirements

Software Engineering 138

Page 139: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

States and Exit Transitions for Order

Software Engineering 139

Page 140: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

First-Cut State Machine Diagram for Order

Software Engineering 140

Page 141: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Second-Cut State Machine Diagram for Order

Software Engineering 141

Page 142: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Integrating Object-Oriented Models

• Primary (or source) models– Use case diagram – Problem domain class diagram

• CRUD analysis validates model completeness• Construction of one model depends on

another • Models capturing processes of new system

– Use case diagram and models to lower left

• Models capturing information about classes– Class diagrams and dependencies

Software Engineering 142

Page 143: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Relationships among OO Requirements Models

Software Engineering 143

Page 144: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Summary

• OOA family of models documents users’ needs and defines system requirements

• Use case detailed models (descriptive or activity)

• Sequence diagrams (SSDs)

• Domain model class diagrams

• Statechart diagrams

Software Engineering 144

Page 145: Topic 4: Object-Oriented Approach to Requirements ... · to Requirements Engineering Software Engineering ... •Information in requirements document depends on type of system and

Summary (continued)

• Use case: single system function responding to an event

• Actors: human users or system interfaces that initiate system response

• System function decomposed into workflows

• SSDs, domain models, statecharts emulate routines and object interaction

• Software engineering terms signal transition into design phase

Software Engineering 145