29
1 Chapter 13 Chapter 13 Design Concepts and Design Concepts and Principles Principles

1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

Embed Size (px)

Citation preview

Page 1: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

1

Chapter 13 Chapter 13 Design Concepts and Design Concepts and

PrinciplesPrinciples

Page 2: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

2

Analysis to Analysis to DesignDesign

Entity-Relationship

Diagram

Data FlowDiagram

State-TransitionDiagram

Data Dictionary

Process Specification (PSPEC)

Control Specification (CSPEC)

Data Object Description

THE ANALYSIS MODEL

proceduraldesign

interfacedesign

architecturaldesign

datadesign

THE DESIGN MODEL

component- level design

Page 3: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

3

Where Do We Where Do We Begin?Begin?

Spec

PrototypePrototype

DesignDesign

modeling

Page 4: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

4

Implement all explicit and implicit Implement all explicit and implicit requirementsrequirements

Be a readable and understandable guide Be a readable and understandable guide for developers and customersfor developers and customers

Provide a complete picture of softwareProvide a complete picture of software

A good A good designdesign

Page 5: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

5

Design Principles Design Principles (1)(1)

The design process should not suffer The design process should not suffer from ‘from ‘tunnel visiontunnel vision.’ .’

The design should be The design should be traceabletraceable to the to the analysis model. analysis model.

The design should not The design should not reinventreinvent the the wheel. wheel.

The design should “The design should “minimizeminimize the the intellectual distance” between the intellectual distance” between the software and the problem as it exists in software and the problem as it exists in the real world. the real world.

The design should exhibit The design should exhibit uniformity uniformity and and integrationintegration. .

From Davis [DAV95]

Page 6: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

6

Design Principles Design Principles (2)(2)

The design should be structured to The design should be structured to accommodate accommodate changechange. .

The design should be structured to The design should be structured to degrade degrade gently, even when aberrant data, gently, even when aberrant data, events, or operating conditions are events, or operating conditions are encountered. encountered.

Design is not coding, coding is not design. Design is not coding, coding is not design. The design should be The design should be assessedassessed for quality for quality

as it is being created, not after the fact. as it is being created, not after the fact. The design should be The design should be reviewedreviewed to to

minimize conceptual (semantic) errors.minimize conceptual (semantic) errors.

From Davis [DAV95]

Page 7: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

7

Fundamental Fundamental ConceptsConcepts Abstraction Abstraction — data, procedure, control— data, procedure, control

Refinement Refinement — elaboration of detail for bstractions— elaboration of detail for bstractions Modularity Modularity — compartmentalize data and function— compartmentalize data and function Architecture Architecture — overall structure of the software— overall structure of the software Partitioning Partitioning — partition the program structure— partition the program structure Data structureData structure — the logical relationship of data — the logical relationship of data Procedure Procedure — the algorithms that achieve function— the algorithms that achieve function Hiding Hiding — controlled interfaces— controlled interfaces Function independencesFunction independences —— cohesion, couplingcohesion, coupling

Page 8: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

8

AbstractiAbstractionon

Data abstractionData abstraction Procedure abstractionProcedure abstraction Control abstractionControl abstraction

Page 9: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

9

Data Data AbstractionAbstraction

door

implemented as a data structure

manufacturermodel numbertypeswing directioninsertslights type numberweightopening mechanism

Page 10: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

10

Procedural Procedural AbstractionAbstraction

open

implemented with a "knowledge" of the object that is associated with enter

details of enter algorithm

Page 11: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

11

RefinemeRefinementnt

open

walk to door;reach for knob;

open door;

walk through;close door.

repeat until door opensturn knob clockwise;if knob doesn't turn, then take key out; find correct key; insert in lock;endifpull/push doormove out of way;end repeat

Refinement Refinement — elaboration of detail for all — elaboration of detail for all abstractionsabstractions

Page 12: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

12

Modular Modular DesignDesignmodularitymodularity—compartmentalization of data & —compartmentalization of data &

functionfunction

Page 13: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

13

Sizing Modules: Two Sizing Modules: Two ViewsViews

MODULE

What's inside??

How big is it??

Page 14: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

14

Modularity: Modularity: Trade-offsTrade-offsWhat is the "right" number of modules What is the "right" number of modules

for a specific software design?for a specific software design?

optimal numberoptimal number of modulesof modules

cost ofcost of softwaresoftware

number of modulesnumber of modules

modulemoduleintegrationintegration

costcost

module development cost module development cost

Page 15: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

17

ArchitectArchitectureure““The The overall structureoverall structure of the software and the of the software and the

ways in which that structure provides ways in which that structure provides conceptual integrity for a system.” [SHA95a]conceptual integrity for a system.” [SHA95a]

superordinate

subordinate

Page 16: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

18

Partitioning the Partitioning the ArchitectureArchitecture

““horizontal” and “vertical” horizontal” and “vertical” partitioning are requiredpartitioning are required

Page 17: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

19

Horizontal PartitioningHorizontal Partitioning

define separate branches of the define separate branches of the module hierarchy for each major module hierarchy for each major functionfunction

use control modules to coordinate use control modules to coordinate communication between functionscommunication between functions

function 1function 1 function 3function 3

function 2function 2

Page 18: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

21

Vertical Partitioning:Vertical Partitioning:FactoringFactoring

design so that decision making and design so that decision making and work are stratifiedwork are stratified

decision making modules should decision making modules should reside at the top of the architecturereside at the top of the architecture

workersworkers

decision-makersdecision-makers

Page 19: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

22

Data Data StructureStructure

Item: integer, Item: integer, string…string…

Vector: arrayVector: array Space: structureSpace: structure Linked list, nodeLinked list, node

Data Structure Data Structure — a representation of — a representation of the the logical logical relationshiprelationship

Page 20: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

23

Software Software ProcedureProcedure

Procedure Procedure — a precise — a precise specification of specification of processingprocessing

Page 21: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

24

Information HidingInformation Hiding

modulemodulecontrolledcontrolledinterfaceinterface

"secret""secret"clientsclients

a specific design decisiona specific design decision

Hiding Hiding — controlled — controlled interfacesinterfaces

Page 22: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

26

Functional Functional IndependenceIndependence

COHESION - the degree to which a module performs one and only one function.

COUPLING - the degree to which a module is "connected" to other modules in the system.

Page 23: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

27

CohesioCohesionnThe degree to which a module performs one and only one function

Page 24: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

28

CouplinCouplinggA measure of interconnection among modules

Page 25: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

29

stampdata

control

uncouple

common

content

Page 26: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

31

Design Design Heuristics Heuristics

1.1. Evaluate the “first iteration” of the program Evaluate the “first iteration” of the program structure to reduce coupling and improve structure to reduce coupling and improve cohesion.cohesion.

2.2. Attempt to minimize structures with high fan-Attempt to minimize structures with high fan-out; strive for fan-in as depth increases.out; strive for fan-in as depth increases.

3.3. Keep the scope of effect of a module within the Keep the scope of effect of a module within the scope of control of that module.scope of control of that module.

4.4. Evaluate module interfaces to reduce Evaluate module interfaces to reduce complexity and redundancy and improve complexity and redundancy and improve consistency.consistency.

5.5. Define modules whose function is predictable, Define modules whose function is predictable, but avoid modules that are overly restrictive.but avoid modules that are overly restrictive.

6.6. Strive for “controlled entry” modules by Strive for “controlled entry” modules by avoiding “pathological connections.”avoiding “pathological connections.”

Page 27: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

32

Page 28: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

33

Page 29: 1 Chapter 13 Design Concepts and Principles. 2 Analysis to Design component- level design

34

Design Design SpecificationSpecification