DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain...

66
DESIGN 2: DETAILED DESIGN

Transcript of DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain...

Page 1: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

DESIGN 2:DETAILED DESIGN

Page 2: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Plan project

Integrate & test system

Analyze requirements

Design

Maintain

Test unitsImplement

Software Engineering Roadmap:

Chapter 6 Focus

Identify corporate practices

Develop Architecture - see chapter 5

Perform Detailed Design - apply design patterns - accommodate use cases

supply methods - exploit libraries (Java, Swing…) - describe methods where required - develop detailed object models - dev. detailed logic (pseudo-code)

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 3: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Chapter Learning Goals

• Understand how design patterns

describe some detailed designs

• Specify classes and functions completely

• Specify algorithms

– use flowcharts

– use pseudocode

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 4: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

1. Introduction to Detailed Design Objective: To fully prepare for implementation of a system that meets requirements.Outcomes: (1) blueprints (models),(2) associated details (documentation), (3) detailed implementation plan for construction, integration and testing

Page 5: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Relating Use Cases, Architecture, & Detailed Design

1. Use case -- analysis

“Cars should be able to travel from the top of Smith Hill at 65 mph, travel in a straight line, and arrive at Jones Hollow within 3 minutes.”

3. Architecure2. Domainclasses

Auto

Road

Cable

Pylon

Page 6: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Relating Use Cases, Architecture, & Detailed Design

1. Use case (part of requirements)

“Cars should be able to travel from the top of Smith Hill at 65 mph, travel in a straight line, and arrive at Jones Hollow within 3 minutes.”

3. Architecure2. Domainclasses

Auto

Road

Support use case Auto

Road4. DetailedDesign

Smith Hill

Cable

Cable

Jones Hollow

Pylon

Pylon

(not specifically required)

(added for detailed design)

Guardrail

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 7: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

• What is the difference between high-level (architectural) design and detailed design?

• High-Level Design

• Detailed Design

Page 8: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Typical Roadmap

for Detailed Design

8.Release for implementation

1. Begin with architectural models -- see chapter 5

• class model: domain & architectural classes• overall state model* • overall data flow model*• use case model

6. Sketch unit test plans -- see chapter 8

7. Inspect test plans & design -- section 9

3. Refine models, make consistent, ensure complete

5. Specify methods with pre- and post-conditions, flowcharts* & pseudocode* -- sections 3 and 4

2. Introduce classes & design patterns* which connect the architecture classes with the domain classes -- sections 1 and 5

• concentrate on riskiest parts first; try alternatives

4. Specify class invariants* -- section 3.1

* if applicable

For each class ...

For each method ...

For each unit ...

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 9: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Organize the Team for Detailed Design 1/2

1. Prepare for a detailed design kick-off meeting.

– Ensure team members aware of the models (views) they

are expected to produce

• typically object model, sequence diagrams, state, & data flow

– Ensure team members aware of the notation expected

• typically: UML plus a pseudocode standard and/or example

– Design leader prepares list of modules

– Design leader creates a meeting agenda

– Project leader allocates time to agenda items

(people can speak about detailed designs indefinitely if allowed to!)

• allocate the time among the agenda items

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 10: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Organize the Team for Detailed Design 2/2

2. Hold the kick-off meeting – Designate someone to monitor the agenda item time– Confirm that the architecture is ready for detailed design

• Make sure that module interfaces the are clear– revise as a group if not

• Don’t try to develop detailed designs as a group– not necessary: individuals have the responsibility– groups are seldom good at designing details together

– Allocate modules to members• Request time estimates to design lead by a fixed date

– Write out the conclusions and copy/e-mail every member

– Decide how and when the results are to be reviewed3. Update the documentation set

– more detailed schedule with modules & inspections4. Inspect the detailed designs (see section 9)5. Rework as a result of inspections6. Conduct post mortem and write out lessons learned

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 11: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Unified Software Development Process: Design

Inception Elaboration Construction TransitionU. P. Term

Requirements

Analysis

Design

Implemen-tation

Test

(Jacobson et al) Prelim.iterations

Iter.#1

Iter.#n

Iter.#n+1

Iter.#m

Iter.#m+1

Iter.#k

….. …..

1*

3

2

1 = 3 =2 =*Key: terminology used in this book “Requirements” “Achitecture” “Detailed

design”

Jacobson et al:

Page 12: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Analysis

1. Conceptual & abstract

2. Applicable to several designs

3. «control», «entity» & «boundary» class stereotypes

4. Less formal

5. Less expensive to develop

1. Concrete: implementation blueprint

2. Specific for an implementation

3. No limit on class stereotypes

4. More formal

5. More expensive to develop (~ 5 times)

After Jacobson et al: USDP

Design 1/2

Page 13: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

6. Outlines the design

7. Emerges from conceptual thinking

8. Flexibility still exists for process modifications

9. Relatively unconstrained

10. Less focus on sequence diagrams

11. Few layers

6. Manifests the design (architecture one view)

7. May use tools (e.g. visual, round-trip engineering)

8. Maintaining estabished process is a high priority

9. Constrained by the analysis & architecture

10. More focus on seq. diag.

11. Many layers

Analysis

After Jacobson et al: USDP

Design 2/2

Page 14: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Designing Against Interfaces

Customerbill()

printAccounts()

RegularCustomerbill()

printAccounts()

BillingClientlistCustomers()billCustomers()

Abstract layer

Concrete (non-abstract) layer

Client code Used code

-- written in terms of Customer (not specific types of Customer)

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 15: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Reusing Components

• Functionality we need is becoming more convenient to locate and reuse– Microsoft MFC library– Visual Basic controls– COM objects– OMG’s CORBA– Javascript and Java Applet libraries– JavaBeans (servlet code)– Enterprise JavaBeans

Page 16: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

2. Sequence and data flow diagrams for detailed design

Page 17: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Refine Models for Detailed Design

1/2: Sequence Diagrams1. Begin with the sequence diagrams constructed for

detailed requirements and/or architecture (if any) corresponding to the use cases.

2. Introduce additional use cases, if necessary, to describe how parts of the design typically interact with the rest of the application.

3. Provide sequence diagrams with complete details– be sure that the exact objects & their classes are specified

– select specific function names in place of natural language(calls of one object to another to perform an operation)

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 18: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

1. Gather data flow diagrams (DFD’s) constructed for detailed requirements and/or architecture (if any).

2. Introduce additional DFD’s, if necessary, to explain data and processing flows.

3. Indicate what part(s) of the other models the DFD’s corresponds to. – e.g., “the following DFD is for each Account object”

4. Provide all details on the DFD’s– indicate clearly the nature of the processing at each node– indicate clearly the kind of data transmitted– expand processing nodes into DFD’s if the processing

description requires more detail

Refine Models for Detailed Design2/2: Data Flow Diagrams

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 19: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

1.1 create; display

Requirements: Sequence Diagram for Engage Foreign Character Use Case

2.1 execute

3.1 Display result

3.2 create

:EngagementDisplay

:Engagement

2.2 change quality values

1.2 create

:Player Character

:EncounterGame

freddie: Foreign

Character

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 20: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

2. execute()

2.1 setPlayerQuality()

2.3 setForeignQuality()

engagement:Engagement

1.3 new Engagement()

3.2 displayResult()

:Player’s main

character

:Encountergame

Design: Sequence Diagram for Encounter Foreign Character Use Case

:EngagementDisplay

freddie: Foreign

Character

1.2 display()

:EncounterCast

1.1 displayForeignChar()

2.2 setQuality()

2.4 setQuality()

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

3.1 new EngagementDisplay()

Page 21: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Classes of the EncounterForeignCharacter Use Case

Engagementexecute()

EngagementDisplaydisplayResult()

EncounterGame

EncounterCastdisplayForeignChar()

setPlayerQuality()setForeignQuality()

ForeignCharactersetQuality()

PlayerCharactersetQuality()

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 22: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Detailed Data Flow Diagram for a Banking Application

User

Customer.getDetails()

customer infoAccount.

getDeposit()

screentemplate

Account.getPass-word()Account.

verifyPass-word()

pass-word

Account

unacceptableATM users

Cus-tomer

Deposit-screen.

display()

status

locallog

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 23: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

CRC Cards

• Class Responsibility and Collaboration cards provide an effective technique for exploring the possible ways of allocating responsibilities to classes and the collaborations that are necessary to fullfil the responsibilities.

• A helpful demonstration:– http://www.csd.abdn.ac.uk/~ecompata/teaching

/CS3015/information/crc.shtml

Page 24: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Design Refinement with CRC Cards

• Exercise:

• Use Case: You are registering for a new course in astronomy. You require permission from the instructor and you must interact with the registrars office to signup and pay for the course.

• Develop the classes and responsibilities using CRC cards

Page 25: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

3. Specifying classes and functions

Page 26: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

1. Gather the attributes listed in the SRS.

– if the SRS is organized by class

2. Add additional attributes required for the design.

3. Name a method corresponding to each of the

requirements for this class.

– easy if the SRS is organized by class

4. Name additional methods required for the design.

5. Show the attributes & methods on the object model.

6. State class invariants.

Specify A Class

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 27: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Specify a Function

1. Note the section(s) of the SRS or SDD which this function (method) satisfies.

2. State what expressions the function must leave invariant.

3. State the method’s pre-conditions (what it assumes).

4. State the method’s post-conditions (its effects).

5. Provide pseudocode and/or a flowchart to specify the

algorithm to be used.

– unless very straightforward

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 28: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Classes at Detailed Design

Responsibilities:-- describes each canister undergoing fabrication

+ display()- getNumSlotsOpen()+ setStatus()

+ numCanisters: int - numWafers: int- size: float

Canister Class name

Attribute: type

+: visiblefrom without Operations

Place for comments

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Data type Range

Default valueSecurity issues

Interface specsFunctional

detailsInvariants

Instance details

Page 29: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

4. Specifying algorithms

Page 30: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Flowchart Examplefor setName()

protected final void setName( String aName ) { // Check legitimacy of parameter and settings if( ( aName == null ) || ( maxNumCharsInName() <= 0 ) || ( maxNumCharsInName() > alltimeLimitOfNameLength() ) ) { _name = new String( "defaultName" ); System.out.println ( "defaultName selected by GameCharacter.setName()"); } else // Truncate if aName too long if( aName.length() > maxNumCharsInName() ) _name = new String ( aName.getBytes(), 0, maxNumCharsInName() ); else // assign the parameter name _name = new String( aName ); }

Parameter & settings make

sense?

Set _name to “defaultName"

Y

Parameter name too

long?

N

Truncate name

Set _name to parameter

YN

Nominal path

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 31: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

FOR number of microseconds supplied by operator 

IF number of microseconds exceeds critical value

Try to get supervisor's approval

IF no supervisor's approval

abort with "no supervisor approval for unusual

duration" message ENDIF ENDIF

Pseuodocode Example

See later section tbd for inspection results of this pseudocode

. . . .

Page 32: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

//p FOR number of microseconds supplied by operator

for( int i = 0; i < numMicrosecs; ++I ) {

//p IF number of microseconds exceeds critical value

if( numMicrosecs >

XRayPolicies.CRITICAL_NUM_MICROSECS )

//p Try to get supervisor's approval

int supervisorMicrosecsApproval =

getApprovalOfSuperForLongExposure(); 

//p IF no supervisor approval

if( supervisorMicrosecsApproval <= 0 )

throw ( new SupervisorMicrosecsApprovalException() );

. . . . . . . . .

Pseudocode Extraction

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 33: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Advantages of Pseudocode & Flowcharts

Clarify algorithms in many cases

Impose increased discipline on the process of

documenting detailed design

Provide additional level at which inspection can

be performed

Help to trap defects before they become code

Increases product reliability

May decrease overall costs

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 34: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Disadvantages of Pseudocode & Flowcharts

Creates an additional level of documentation to

maintain

Introduces error possibilities in translating to code

May require tool to extract pseudocode and

facilitate drawing flowcharts

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 35: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

5. Design Patterns II: Techniques of detailed design

Page 36: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Apply Design Patterns in Detailed Design

1. Become familiar with the design problems solved by design patterns– at a minimum, understand the distinction among (C)

creational vs. (S) structural vs. (B) behavioral patternsConsider each part of the detailed design in turn: 2. Determine whether the problem has to do with (C)

creating something complex, (S) representing a complex structure, or (B) capturing behavior

3. Determine whether there is a design patterns that addresses the problem– try looking in the category identified (C, S, or B)

• use this book and/or Gamma et al [Ga]

4. Decide if benefits outweigh drawbacks– benefits usually include increased flexibility– drawbacks increased class complexity(?), less efficient(?)

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 37: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

User Interface Design

• System users often judge a system by its interface rather than its functionality

• A poorly designed interface can cause a user to make catastrophic errors

• Poor user interface design is the reason why so many software systems are never used

Page 38: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

User-Centred design

• User-centred design is an approach to UI design where the needs of the user are paramount and where the user is involved in the design process

• UI design always involves the development of prototype interfaces

• See UI_design.ppt

Page 39: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

7. Standards, notation and tools for detailed design

Page 40: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

IEEE 1016-1987 Software Design Document Table of Contents (Reaffirmed 1993)

1. Introduction 1.1. Purpose 1.2. Scope 1.3. Definitions, acronyms & abbreviations2. References3. Decomposition description 3.1. Module decomposition 3.1.1 Module 1 description 3.1.1 Module 2 description 3.2 Concurrent process decomposition 3.2.1 Process 1 description 3.2.2 Process 2 description 3.3 Data decomposition 3.3.1 Data entry 1 description 3.3.2 Data entry 2 description

4. Dependency description 4.1 Intermodule dependencies 4.2 Interprocess dependencies 4.3 Data dependencies5. Interface description 5.1 Module interface 5.1.1 Module 1 description 5.1.2 Module 2 description 5.2 Process interface 5.2.1 Process 1 description 5.2.2 Process 2 description6. Detailed design 6.1 Module detailed design 6.1.1 Module 1 detail 6.2.2 Module 2 detail 6.2 Data detailed design 6.2.1 Data entity 1 detail 6.2.2 Data entity 2 detail

Architecture

Can be replaced with:6.1 Class#1 detailed design

6.1.1 Attributes6.1.2 Methods6.1.3 Instance details6.1.4. Other:

- UI details (if applicable)

Page 41: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

8. Effects on projects of completing detailed designs

Page 42: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

1. Make sure the SDD reflects latest version of detailed design, as settled on after inspections.

2. Give complete detail to the schedule (SPMP).3. Allocate precise tasks to team members (SPMP).4. Improve project cost & time estimates (see below).5. Update the SCMP to reflect the new parts. 6. Review process by which the detailed design was

created, & determine improvements. Include ...– time taken; broken down to include

• preparation of the designs• inspection• change

– defect summary• number remaining open, found at detailed design, closed at

detailed design• where injected; include previous phases & detailed design stages

Bring the ProjectUp-to-Date

After Completing Detailed Design

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 43: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Estimate Size & Time from Detailed Designs

1. Start with the list of methods– ensure completeness, otherwise underestimate will result

2. Estimate the lines of code (LOC) for each – classify as very small, small, medium, large, very large

• normally in ± 7% / 24% / 38% / 24% / 7% proportions

– use personal data to covert to LOC• otherwise use Humphry’s table below

3. Sum the LOC4. Covert LOC to person-hours

– use personal conversion factor if possible• otherwise use published factor

5. Ensure that your estimates of method sizes and time will be compared and saved at project end.

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 44: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

9. Quality in detailed designs

Page 45: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Inspect‡ Detailed Designs 1 of 2

1. Prepare to record metrics during the design process.

– Include (1.1) time taken; (1.2) type of defect; (1.3) severity

2. Ensure each architecture module is expanded.

3. Ensure each detail is part of the architecture.

– if a detail does not belong to any such module, the

architecture may have to be revised

4. Ensure the design fulfills its required functions

5. Ensure that design is complete (classes & methods)

6. Ensure that the design is testable.

‡ See chapter 1 for inspection procedures.Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 46: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

7. Check detailed design for --– simplicity

a design that few can understand (after a legitimate effort!) is expensive to maintain, and can result in defects

– generalityenables design of similar applications?

– expandabilityenables enhancements?

– efficiencyspeed, storage

– portability

8. Ensure all details are provided– only code itself is excluded as a “detail”– the detail work must be done eventually, and this

is the best time to do it: don’t postpose

Inspect Detailed Designs 2 of 2

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 47: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Inspection for Defects

• Identify defect and its type• Specify its severity (two methods following slides)

• Identify the source of the defect – so that the defect does not occur in another project

• At another time, usually one person works on a resolution to defect

Page 48: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Severity Description

UrgentFailure causes system crash, unrecoverable data loss; or jeopardizes personnel

HighCauses impairment of critical system functions, and no workaround solution does exist

MediumCauses impairment of critical system functions, though a workaround solution does exist

Low Causes inconvenience or annoyance

None None of the above

Table 6.2 IEEE 1044.1 Severity classification

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 49: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Severity Description

Major Requirement(s) not satisfied

Medium Neither major nor trivial

Trivial A defect which will not affect operation or maintenance

Table 6.3 Defect severity classification using Triage

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 50: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Types of Defects (1) (IEEE)

• [PS] Logic problem (forgotten cases or steps; duplicate logic; extreme conditions neglected; unnecessary functions; misinterpretation; missing condition test; checking wrong variable; iterating loop incorrectly etc.)

• [PS] Computational problem (Equation insufficient or incorrect; precision loss; sign convention fault)

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 51: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Types of Defects (3)

• [XDOC, PS] Data problem (sensor data incorrect or missing; operator data incorrect or missing; embedded data in tables incorrect or missing; external data incorrect or missing; output data incorrect or missing; input data incorrect or missing)

• [XDOC, PS] Documentation problem (ambiguous statement etc.)

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 52: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Types of Defects (4)

• [XDOC, PS] Document quality problem

(Applicable standards not met etc.)

• [XDOC, PS] Enhancement (change in

program requirements etc.)

• [XDOC, PS] Failure caused by a previous fix

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 53: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Types of Defects (5)

• [PS] Suspect performance problem (inefficient

logic, data structure)

• [XDOC, PS] Interoperability problem (not

compatible with other software or component)

• [XDOC, PS] Standards conformance problem

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 54: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

IF aQuality is not recognizedLog error to log file Inform user qualities unchanged

ELSE IF aQualityValue out of bounds

Log error to log fileInform user qualities unchanged

ELSESet the stated quality to aQualityValueReduce the remaining qualities, ... retaining their mutual proportion, ... making the sum of qualities unchanged

ENDIFENDIF

Pseudocodefor Inspection1

2345678910

setQuality() should be mentioned

Lacks detail on how to allocate the remaining quality values

Make these preconditions; don’t check.

Page 55: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Case Study

Page 56: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Detailed Design of RolePlayingGame Package

RPGamehandleEvent()

GameStatehandleEvent()state

{ state.handleEvent(); }

. . . .

Page 57: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Detailed Design of RolePlayingGame Package

RPGamehandleEvent()

GameStatehandleEvent()stateS

{ stateS.handleEvent(); }

RPGMouseEventListenermouseEnter()

MouseListener

{ rPGameS.handleEvent(); }

rPGameS

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 58: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

eventTarget

2. mouseClicked()

User

1. mouseaction

3. handleEvent( Event )

:RPGame :GameState

4. handleEvent( Event)

:RPGMouseEventListener

Sequence Diagram forHandling Mouse Events

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 59: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

RPG Video Game Architecture Packages -- showing domain classes only

«framework package»

«framework package»

«framework package»

«framework package»

«application package»

Characters

GameArtifacts

RolePlayingGame

GameEnvironment

EncounterEnvironment

PlayerCharacter

EncounterCharacter

«application package»

ForeignCharacter

EncounterCharacters «application package»

EncounterGame Engagement

EngagementDisplay

EncounterGame

Area

PlayerQualityWindow

«uses»

«uses»

«uses»

EncounterAreaConnection

ConnectionHyperlink

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 60: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

EncounterGameDisplays

Detailed Design of EncounterGameDisplays

Sub-package

EngagementDisplay

PreparinghandleEvent()

ReportinghandleEvent()

SetQualityDisplay

EncounterDisplayItem

QualListDispl

QualValueDispl

SetQualValueDispl

EncounterCast

EncounterDisplay

MouseListener

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 61: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

:EngagementDisplay

2. mouseClicked()

User

1. hit dismissbutton

:RPGMouseEventListener

3. handleEvent()

:EncounterGame

:ReportingEncounter

4. handleEvent()

5. setVisible( false )

6. setState(new Waiting())

Sequence Diagram forDismissing Engagement

Display

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 62: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

:PlayerQualityWindow

2. mouseClicked()

User

1. hit dismissbutton

:RPGMouseEventListener

3. handleEvent()

:EncounterGame

:SettingUp

4. handleEvent()

5. setVisible( false )

6. setState(new Waiting())

Sequence Diagram for Player Completes Setup

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 63: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

:AreaConnectionHyperlink

2. mouseClicked()

User

1. hit areaconnectionhyperlink

:RPGMouseEventListener

:Waiting

4. handleEvent()5. setVisible( false )

9. setState(new Engaging())

6. displayArea()

7. displayPlayerCharacter()

3. handleEvent()

:EncounterGame

:EncounterEnvironment

:EncounterCast

If foreign character present

8. displayForeignCharacter()

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Sequence Diagram for Player Moves to

Adjacent Area

Page 64: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

Detailed Design of EncounterCharacters Package

«facade»

EncounterCast

PlayerCharacter

ForeignCharacter

Characters«framework package»

GameCharacter

EncounterCharacters«application package»

EncounterCharacter

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.

Page 65: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

EncounterEnvironment Package

GameEnvironment

GameCharacterGameArea

GameAreaConnection

. . . .

Page 66: DESIGN 2: DETAILED DESIGN. Plan project Integrate & test system Analyze requirements Design Maintain Test unitsImplement Software Engineering Roadmap:

EncounterEnvironment Package

GameEnvironment

GameCharacterGameArea

EncounterEnvironment

Area

EncounterEnvironment

GameAreaConnection

EncounterAreaConnection

ConnectionHyperlink

Adapted from Software Engineering: An Object-Oriented Perspective by Eric J. Braude (Wiley 2001), with permission.