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

Post on 15-Jan-2016

220 views 0 download

Transcript of 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

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

3

Where Do We Where Do We Begin?Begin?

Spec

PrototypePrototype

DesignDesign

modeling

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

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]

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]

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

8

AbstractiAbstractionon

Data abstractionData abstraction Procedure abstractionProcedure abstraction Control abstractionControl abstraction

9

Data Data AbstractionAbstraction

door

implemented as a data structure

manufacturermodel numbertypeswing directioninsertslights type numberweightopening mechanism

10

Procedural Procedural AbstractionAbstraction

open

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

details of enter algorithm

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

12

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

functionfunction

13

Sizing Modules: Two Sizing Modules: Two ViewsViews

MODULE

What's inside??

How big is it??

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

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

18

Partitioning the Partitioning the ArchitectureArchitecture

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

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

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

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

23

Software Software ProcedureProcedure

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

24

Information HidingInformation Hiding

modulemodulecontrolledcontrolledinterfaceinterface

"secret""secret"clientsclients

a specific design decisiona specific design decision

Hiding Hiding — controlled — controlled interfacesinterfaces

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.

27

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

28

CouplinCouplinggA measure of interconnection among modules

29

stampdata

control

uncouple

common

content

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

32

33

34

Design Design SpecificationSpecification