Top Banner
1 CSC 330 Object Oriented Software Design Software Design Phase Software Design Phase
44

Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

May 12, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

1

CSC 330 Object Oriented Software Design

Software Design PhaseSoftware Design Phase

Page 2: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

2

OverviewOverview• Overview• Design and abstraction• Action-oriented design• Data flow analysis• Transaction analysis• Data-oriented design• Object-oriented design• Elevator problem: object-oriented design• Air Gourmet Case Study: object-oriented design

Page 3: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

3

Data and ActionsData and Actions

• Two aspects of a product– Actions which operate on data– Data on which actions operate

• The two basic ways of designing a product– Action-oriented design– Data-oriented design

• Third way– Hybrid methods– For example, object-oriented design

Page 4: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

4

Design Activities

• Architectural design• Detailed design• Design testing

Page 5: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

5

Architectural DesignArchitectural Design

• Input: Specifications• Output: Modular decomposition• Abstraction

Page 6: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

6

Detailed DesignDetailed Design

• Each module is designed– Specific algorithms– Data structures

Page 7: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

7

ActionAction--Oriented Design MethodsOriented Design Methods

• Data flow analysis• When to use it

– With most specification methods (Structured Systems Analysis here)

• Key point: Have detailed action

Page 8: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

8

Data Flow AnalysisData Flow Analysis

• Product transforms input into output• Determine

– “Point of highest abstraction of input”– “Point of highest abstract of output”

Page 9: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

9

Data Flow Analysis contData Flow Analysis cont’’dd

• Decompose into three modules• Repeat stepwise until each module has

high cohesion– Minor modifications may be needed to

lower coupling

Page 10: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

10

Data Flow Analysis contData Flow Analysis cont’’dd• Example

Design a product which takes as input a file name, and returns the number of words in that file

Page 11: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

11

Data Flow Analysis Example contData Flow Analysis Example cont’’dd• First refinement

• Refine modules of communicational cohesion

Page 12: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

12

Data Flow Analysis Example contData Flow Analysis Example cont’’dd

• Second refinement

• All eight modules have functional cohesion

Page 13: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

13

Transaction AnalysisTransaction Analysis• DFA poor for transaction processing products

– Example: ATM (Automatic Teller Machine)

• Poor design– Logical cohesion, control coupling

Page 14: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

14

Corrected Design Using Transaction AnalysisCorrected Design Using Transaction Analysis

• Software reuse

Page 15: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

15

DataData--Oriented DesignOriented Design• Basic principle

– The structure of a product must conform to the structure of its data

• Three very similar methods– Warnier– Orr– Jackson

• Data-oriented design– Has never been as popular as action-oriented design– With the rise of OOD, data-oriented design has

largely fallen out of fashion

Page 16: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

16

ObjectObject--Oriented Design StepsOriented Design Steps

• OOD consists of four steps:– 1. Construct interaction diagrams for each

scenario– 2. Construct the detailed class diagram– 3. Design the product in terms of clients of

objects– 4. Proceed to the detailed design

Page 17: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

17

Elevator Problem: OODElevator Problem: OOD

• Step 1. Construct interaction diagrams for each scenario

• Sequence diagrams• Collaboration diagrams

– Both show the same thing– Objects and messages passed

between them• But in a different way

Page 18: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

18

Elevator Problem: OOD contElevator Problem: OOD cont’’dd

• Normal scenario

Page 19: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

19

Elevator Problem: OOD contElevator Problem: OOD cont’’dd

• Sequence diagram

Page 20: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

20

Elevator Problem: OOD contElevator Problem: OOD cont’’dd

• Collaboration diagram

Page 21: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

21

Elevator Problem: OOD contElevator Problem: OOD cont’’dd• Step 2. Construct Detailed Class Diagram • Do we assign an action to a class or to a client of that

class? • Criteria

– Information hiding– Reducing number of copies of action– Responsibility-driven design

• Examplesclose doors is assigned to Elevator Doorsmove one floor down is assigned to Elevator

Page 22: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

22

Elevator Problem: OOD contElevator Problem: OOD cont’’dd

• Detailed class diagram

Page 23: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

23

Elevator Problem: OOD contElevator Problem: OOD cont’’dd

• Step 3. Design product in terms of clients of objects

• Draw an arrow from an object to a client of that object

• Objects that are not clients of any object have to be initiated, probably by the main method– Additional methods may be needed

Page 24: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

24

Elevator Problem: OOD contElevator Problem: OOD cont’’dd

• C++ Client-object relations

Page 25: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

25

Elevator Problem: OOD contElevator Problem: OOD cont’’dd

• Java Client-object relations

Page 26: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

26

Elevator Problem: OOD contElevator Problem: OOD cont’’dd

• elevator controller needs method elevator control loop so that main (or elevator application) can call it

Page 27: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

27

Elevator Problem: OOD contElevator Problem: OOD cont’’dd

• Step 4. Perform detailed design

• Detailed design of method elevator controller loop

Page 28: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

28

Formal Techniques for Detailed DesignFormal Techniques for Detailed Design• Implementing a complete product and then proving it

correct is hard• However, use of formal techniques during detailed

design can help– Correctness proving can be applied to module-sized

pieces– The design should have fewer faults if it is developed

in parallel with a correctness proof– If the same programmer does the detailed design and

implementation• The programmer will have a positive attitude to the

detailed design• Should lead to fewer faults

Page 29: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

29

Design of RealDesign of Real--Time SystemsTime Systems• Difficulties associated with real-time systems

– Inputs come from real world• Software has no control over timing of inputs

– Frequently implemented on distributed software• Communications implications• Timing issues

– Problems of synchronization• Race conditions• Deadlock (deadly embrace)

• Major difficulty in design of real-time systems – Determining whether the timing constraints are met

by the design

Page 30: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

30

RealReal--Time Design MethodsTime Design Methods

• Usually, extensions of nonreal-time methods to real-time

• We have limited experience in use of any real-time methods

• The state-of-the-art is not where we would like it to be

Page 31: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

31

Testing during the Design PhaseTesting during the Design Phase

• Design reviews– Design must correctly reflect

specifications– Design itself must be correct– Transaction-driven inspections

Page 32: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

32

CASE Tools for the Design PhaseCASE Tools for the Design Phase

• UpperCASE tools– Built around data dictionary– Consistency checker– Screen, report generators– Modern tools represent OOD using

UML– Examples: Software through Pictures,

Rational Rose

Page 33: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

33

ExampleExample

Page 34: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

34

Air Gourmet Case Study: ObjectAir Gourmet Case Study: Object--Oriented DesignOriented Design

• OOD consists of four steps:– 1. Construct interaction diagrams for each

scenario– 2. Construct the detailed class diagram– 3. Design the product in terms of clients of

objects– 4. Proceed to the detailed design

Page 35: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

35

Step 1. Interaction DiagramsStep 1. Interaction Diagrams• Extended scenario for making a reservation

Page 36: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

36

Step 1. Interaction Diagrams contStep 1. Interaction Diagrams cont’’dd

• Sequence diagram for making a reservation

Page 37: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

37

Step 1. Interaction Diagrams (contd)Step 1. Interaction Diagrams (contd)

• Collaboration diagram for sending and returning a postcard

Page 38: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

38

Step 2. Detailed Class DiagramStep 2. Detailed Class Diagram

C++ version Java version

Page 39: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

39

Page 40: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

40

Page 41: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

41

Page 42: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

42

Page 43: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

43

Step 3. ClientStep 3. Client––Object RelationsObject Relations

C++ version Java version

Page 44: Software Design Phase - City University of New YorkSoftware Design Software Design Phase. 2 Overview •Overview • Design and abstraction ... – Warnier –Orr – Jackson ... –

44

Step 4. Detailed DesignStep 4. Detailed Design

• The detailed design can be found in– See the implementation in C++– See the implementation in Java)