design concepts & principles

48
SIM3302 Software Design & Testing by Zaihisma CC 1 SIM3302 SOFTWARE DESIGN & TESTING CHAPTER 1 Design Concepts & Principles

Upload: cyberns

Post on 21-Jan-2017

121 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 1

SIM3302SOFTWARE DESIGN &

TESTING

CHAPTER 1Design Concepts &

Principles

Page 2: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 2

OBJECTIVE

At the end of this chapter, students should be able to: Define what is design Explain the important of design Explain the design process & design

quality Explain the design principles Understand the fundamental software

design concepts Explain and give examples for each of the

design concepts

Page 3: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 3

TRANSITION FROM ANALYSIS TO DESIGN

Page 4: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 4

Data design

Architectural design

Interface design

Component-level design

Data dictionar

y

PSPEC

DFD

CSPEC

STD

ERDDOD

ANALYSIS MODEL

DESIGN MODEL

Page 5: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 5

Page 6: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 6

Design ModelData design Transforms information domain

model into data structures Architectural design

- Defines relationship between structural elements of the SW,  - represent the framework of comp. based sys.

Interface design

- How SW communicates within itself, with systems that interoperate with it, with humans  - a flow of information & type of behavior

Component-level design

Transforms structural elements of the SW architecture into a procedural description of SW components

Page 7: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 7

Importance of SW Design

Quality

Representations of SW

Translate customer

requirements

Page 8: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 8

Design Process SW design is an iterative process Requirements are translated

“blueprint” for constructing the SW

Page 9: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 9

A model of the design process [Budgen,94]

External requirements

1. Identify nature of requirement 2. Analyse

& build model of problem

3.postulate a design solution

4.validate solution

5.refine design solution

6.implement solution

Requirements specification

Functional specification

Functional specification

Seek new solution

Designer’s model

Designer’s model

Design ‘blueprints’

Mismatches between model & requirement

Page 10: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 10

Design Guidelines A design should exhibit an architectural

structure  A design should be modular A design should contain distinct

representations of data, architecture, interfaces, & components

A design should lead to data structures that are appropriate for the objects to be implemented

Page 11: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 11

A design should lead to components that exhibit independent functional characteristics

A design should lead to interfaces that reduce the complexity of connections between modules & external environment

A design should be derived using a repeatable method , driven by information obtained during SW requirement analysis

Design Guidelines ….cont.

Page 12: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 12

Design Principles The design process should not suffer from

‘tunnel vision’ The design should be traceable to the

analysis model The design should not reinvent the wheel The design should ‘minimize the

intellectual distance” between the SW and the problem as it exists in the real world

The design should exhibit uniformity & integration

Page 13: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 13

Design Principles …cont. The design should be structured to

accommodate change The design should structured to degrade

gently, even when aberrant data, events, or operating conditions are encountered

Design is not coding, coding is not design The design should be assessed for Quality

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

minimize conceptual (semantic) errors

Page 14: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 14

Fundamental SW Design Concepts

Abstraction – data, procedure, control

Refinement – elaboration of detail for all abstractions

Modularity – compartmentalization of data & function

Architecture – overall structure of the SW

Procedure – algorithms that achieve function

Information hiding– controlled interfaces

Page 15: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 15

Design Concepts1. Abstraction

• concentrate on the essential features and ignore details that are not relevant

Procedural abstraction = a named sequence of instructions that has a specific & limited function

Data abstraction = a named collection of data that describes a data object

Control abstraction = implies a program control mechanisms without specify internal details

Page 16: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 16

Design Concepts…cont2. Refinement

• stepwise refinement = top down strategy• refine levels of procedural detail• develop hierarchy by decompose a procedural

abstraction in a stepwise fashion until programming languages are reached

• similar to the process of refinement & partitioning in requirement analysis

• abstraction & refinement are complementary concepts

Suppress low-level details

Reveal low-level details

Page 17: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 17

Design Concepts…cont3. Modularity

• system is decomposed into a number of modules• software architecture and design patterns embody

modularity• 5 criteria to evaluate a design method with respect to its

ability to define effective modular system [meyer,88]i. modular decomposability

- provides a systematic approach for decomposing the problem into subproblems

ii. modular composability- enables existing(reusable) design components to be

assembled into a new systemo     

Page 18: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 18

Design Concepts…cont 5 criteria to evaluate a design method with respect

to its ability to define effective modular system [meyer,88]iii. modular understandability

- module can be understood as a standalone unit ( no need to refer to other modules)

iv. modular continuity- small changes to the system requirements

result in changes to individual modulesv. modular protection

- unexpected condition occurs within a module & its effects are constrained within that module

Page 19: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 19

Design Concepts…cont4. Architecture

• is the structure and organization of program components (modules)

• 5 different types of models are used to represent the architectural design :     

i. structural models : represent architecture as an organized collection of program components

ii. framework models : identify repeatable architectural design framework that similar to the types of applications

iii. dynamic models : behavioral aspects of the program architecture

iv. process models : design of the business or technical process of a system

v. functional models : functional hierarchy of a system

Page 20: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 20

Design Concepts…cont

SW architecture

Control hierarchy

Structural partitioning

Data structure

Page 21: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 21

 

SW Architecture- Control Hierarchy

o     also called program structureo     represent the organization of program componentso     depth & width = no. of levels of control & overall

span of controlo     fan-out = no. of. Modules that are directly

controlled by another moduleo     fan-in = how many modules directly control a given

moduleo     super ordinate = module that control another

module o     subordinate = module controlled by another

Page 22: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 22

SW Architecture- Structural Partitioning

o     horizontal partitioning §       defines separate branches of the modular

hierarchy for each major program function§       defines 3 partition = Input, Process, Output§       benefits :

·       easy to test SW·       easy to maintain SW·       propagation of fewer side effects·       easy to extend SW

       drawback: causes more data to be passed across module interfaces, complicate overall control of program flow

Page 23: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 23

SW Architecture- Structural Partitioningo     vertical partitioning (factoring)§       control (decision making) & work should be

distributed Top-Down in program structure§       top level modules – do control function,

low level modules – do the works( input, computation, output tasks )

§       a change in control module will effect the subordinates.

§       a change in worker module will less likely effect others.

Page 24: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 24

SW Architecture- Data Structure representation of the logical

relationship among individual elements of data

the organization, methods of access, degree of associatively & processing alternatives for information

Page 25: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 25

Design Concepts…cont

5. Procedure (refer to diagram given) focuses on the processing details of

each module a precise specification of processing

Page 26: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 26

Design Concepts…cont

6. Information Hiding modules should be specified & designed

so that information (procedure & data) contained within a module in inaccessible to other modules that have no need for such information

Page 27: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 27

Effective Modular Design Concept of functional independence is a

direct outgrowth of :

Functional independence measured by 2 criteria :

modularity

Information hiding

cohesion coupling

Terminology to describe interactions between modules

Page 28: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 28

Effective Modular Design…cont

A piece of SW divided into modules : There is a minimum interactions between

modules [low coupling] AND

High degree of interaction within a module [ high cohesion ] achieved

Individual module can be : DESIGNED, CODED, TESTED OR CHANGED

Page 29: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 29

Effective Modular Design…cont

analogy : 2 SW system

many interactions between modules

few within modulesstrong coupling , weak cohesion

Few interactions between modules

many within modulesweak coupling , strong cohesion

module

Page 30: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 30

Effective Modular Design…cont

COHESION a cohesive module perform a single task. Describes the nature of interactions within a SW module Various types of cohesion :

LOW cohesion(undesirable) HIGH cohesion (desirable)Types of cohesion

coincidental

logical

functional

communicationaltemporal

Page 31: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 31

Effective Modular Design…cont

• Coincidental : grouped into modules in a haphazard way no relationship between component

• Logical : Perform a set of logically similar functions Example : function => output anything

Perform output operations : Output text to screen Output line to printer Output record to file

Page 32: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 32

Design Concepts…cont

• Temporal : Performs a set of functions whose only

relationship is that they have to be carried out at the same time

Example : set of initialization operations Clear screen Open file Initialize total

Page 33: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 33

Design Concepts…cont• Communicational :

Acting on common data are grouped together Example :

i) displays and logs temperatureii) formats and prints total price

• Functional : Optimal type of cohesion Performs single, well-defined action Example :

i) calculate average ii) print result

Page 34: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 34

Effective Modular Design…cont

COUPLING

One module making a

procedure call on another

Important aspect of interaction

between modules SIZE

Page 35: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 35

Coupling

If modules share common data, it should be minimize

Few parameters should be passed between modules in procedure calls [recommended 2 – 4 parameters ]

Types of coupling, from strongly coupled (least desirable ) weakly coupled (most desirable) :

1. Content coupling2. Common coupling3. External coupling4. Control coupling5. Stamp coupling6. Data coupling

Page 36: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 36

Types of coupling1. Content coupling (should be avoided)

module directly affects the working of another module

occurs when a module changes another module’s data or when control is passed from 1 module to the middle of another (as in a jump)

Page 37: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 37

Types of coupling…cont.2. Common coupling

2 modules have shared data occurs when a number of

modules reference a global data area

Page 38: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 38

Types of coupling…cont.3. External coupling

Modules communicate through an external medium (such as file)§    

Page 39: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 39

Types of coupling…cont.4. Control coupling

1 module directs the execution of another module by passing the necessary control information

accomplished by means of flags that set by one module and reacted upon by the dependent module      

Page 40: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 40

Types of coupling…cont.5. Stamp coupling

Occurs when complete data structures are passed from 1 module to another

The precise format of the data structures is a common property of those modules      

Page 41: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 41

Types of coupling…cont.6. Data coupling (low coupling)

Only simple data is passed between modules

1 to 1 correspondence of items exists 

Page 42: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 42

Types of coupling [pressman]

a

cb

d

hgf

e kj

i

Data structure

Data (Var)

Control flag

No direct coupling

Global data area

Page 43: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 43

Structure Chart (SC) also called a hierarchy chart or program structure

chart a design technique that employs functional

decomposition to specify the functions of an application program A method for designing the

detailed structure of individual programs or modules

Is a ‘top-down’ method - it starts with the overall task of the program

Also called ‘stepwise refinement ‘

Page 44: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 44

Structure Chart (SC)…cont A structure chart differs from a physical DFD Transform a physical DFD into a structure

chart by performing 2 forms of analysis : Transform analysis : used to segment sequential

DFD processes into input, processing & output functions

Transaction analysis : used to segment DFD processes into alternate flows of control depending on a condition or user selection

Each DFD process will appear as a structure chart module

Page 45: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 45

A few guidelines to use structure charts effectively :

Level 1 of a SC may have only 1 module ( the boss module, executive module or main module )

 Each module should perform only 1 function Modules at each level should be arranged in

sequential order (Left – Right). [ exception to : modules that represent alternative functions selected by higher-level module ]

Selection symbol used to indicate that not all modules at the next lower level will be performed

Page 46: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 46

A few guidelines to use structure charts effectively :

Loop symbol used to indicate that some or all of the modules at the next lower level will be performed repeatedly until a specified condition is met

Data elements passed between modules should be specified by labeling each data flow symbol with the name assigned to each element in the physical DB design

 

Page 47: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 47

A few guidelines to use structure charts effectively :

Control flows used to indicate a control flag or other value that is direct the flow of control or to report the status of a condition 

Each program structure chart should be reviewed & evaluated to ensure the design works before coding begins

Page 48: Design Concepts & Principles

SIM3302 Software Design & Testing by Zaihisma CC 48

~The End~Source of Materials : Pressman, R. (2003). Software Engineering: A

Practitioner's Approach. 6th & 5th edition. New York: McGraw-Hill.

Somerville I. (2001). Software Engineering. 6th edition. Addison Wesley