Вы находитесь на странице: 1из 34

Software Engineering

Software Design

INTRODUCTION
A design of a system is essentially a blueprint or a plan for a
solution for the system.
Here , we consider a system to be a set of modules with clearly
defined behavior which interact with each other in a defined
manner to produce some behavior or services for its
environment .
The design process for the software has two levels :
Top

level design

Detailed

design

SoftwareEngineering

SoftwareDesign

Slide2

Top

level design (system design) :

Here, we focuses on deciding which module


we need for the system , the specifications for
those modules and how the modules should be
inter connected.

Detailed level design (logical design ) :


Here , the internal design of module, i.e. ,
how the specification of the module can be
satisfied is decided.

SoftwareEngineering

SoftwareDesign

Slide3

DESIGN METHODOLOGY

It is the system approach for creating a design by applying a


set of techniques and guidelines .

TYPES :
1) STRUCTURE DESIGN METHODOLOGY:
It focuses on function oriented method.
2) OBJECT ORIENTED DESIGN METHODOLOGY :
It focuses on object oriented method.

SoftwareEngineering

SoftwareDesign

Slide4

Stages of Design

Problem understanding

Identify one or more solutions

Evaluate possible solutions and choose the most


appropriate depending on the designer's experience and
available resources.

Describe solution abstractions

Look at the problem from different angles to discover the


design requirements.

Use graphical, formal or other descriptive notations to


describe the components of the design.

Repeat process for each identified abstraction


until the design is expressed in primitive terms.

SoftwareEngineering

SoftwareDesign

Slide5

DESIGN PRINCIPLES

The design of system should be correct ,i.e., system built


precisely according to design satisfying the design of system.

To evaluate a design we have to specify some properties and


criteria that can be used for the evaluation. These properties
should be as quantitative as possible.

A design should be verifiable , complete and traceable.

A design should be efficient and simple .

Effectively handling the complexity will not only reduce the


effort needed but also reduces the scope introducing error
during design.

SoftwareEngineering

SoftwareDesign

Slide6

PROBLEM PARTITIONING AND


HIERARCHY

Problem partitioning is essential for solving a complex


problem. It leads to the hierarchy in design.

There are two strategies possible :


1) Top down strategy
2) Bottom up strategy

SoftwareEngineering

SoftwareDesign

Slide7

ABSTRACTION

An abstraction of a component describes the external


behavior of that component without bothering the internal
details that produce the behavior.

There are two common abstraction mechanism for software


system :
1) Functional abstraction : here , module is specified by
the function it performs. Eg : log function.
2) Data abstraction : it focuses on the object .Here, the
data is not only treated as object with some pre defined
operations on them .It is used within object oriented design.

SoftwareEngineering

SoftwareDesign

Slide8

Modularity

"modularity is the single attribute of software that


allows a program to be intellectually manageable.
It is clearly a desirable property in a system.
For modularity , each module needs to support a well
defined abstraction and have a clear interface through
which it can interact with other modules.
In almost all instances, you should break the design into
many modules, hoping to make understanding easier
and as a consequence, reduce the cost required to build
the software

SoftwareEngineering

SoftwareDesign

Slide9

Top-down and bottom-up design


Top-down

design

Top-down design involves starting at the uppermost components in the


hierarchy and working down the hierarchy level by level.

First design the very high level structure of the system.

Then gradually work down to detailed decisions about low-level


constructs.

Finally arrive at detailed decisions such as:

the format of particular data items;

the individual algorithms that will be used.

SoftwareEngineering

SoftwareDesign

Slide10

Top-down and bottom-up design

Bottom-up design

It starts with designing the most basic components and proceeds to


higher level components that use these lower level components

Make decisions about reusable low-level utilities.

Then decide how these will be put together to create high-level


constructs.

A mix of top-down and bottom-up approaches are


normally used (sandwich approach):

Top-down design is almost always needed to give the system a good


structure.

Bottom-up design is normally useful so that reusable components


can be created.

SoftwareEngineering

SoftwareDesign

Slide11

MODULE LEVEL CONCEPTS

SoftwareEngineering

SoftwareDesign

Slide12

INTRODUCTION

A module is a logically separable part of a program. It is a


program unit that is discreet and identifiable with respect to
compiling and loading.

In a system using functional abstraction , there are two


modularization criteria :
1) coupling
2) cohesion

SoftwareEngineering

SoftwareDesign

Slide13

Coupling

The degree of dependence such as the amount of interactions among


components

Highly coupled modules are joined by strong interconnections while loosely


coupled modules have weak interconnections.

No dependencies

Loosely coupled
some dependencies

Highly coupled
many dependencies

14

SoftwareEngineering

SoftwareDesign

Slide14

Tight Coupling

Module A

Module B

Module C

Module D
Shared data
area

SoftwareEngineering

SoftwareDesign

Slide15

Loose Coupling
Module A
As data

Module B

Module C

Bs data

Cs data

Module D
Ds data
SoftwareEngineering

SoftwareDesign

Slide16

Type of Coupling
High Coupling

Loose

Content
Common
External
Control
Stamp
Data
Uncoupled

Low

SoftwareEngineering

Avoid

SoftwareDesign

Try to achieve

Slide17

Cohesion

Definition

The degree to which all elements of a component are directed


towards a single task.

The degree to which all elements directed towards a task are


contained in a single component.

The degree to which all responsibilities of a single class are


related.

Internal glue with which component is


constructed
All elements of component are directed
toward and essential for performing the same
task.

SoftwareEngineering

SoftwareDesign

Slide18

Type of Cohesion
High Cohesion
Functional
Sequential
Communicational
Procedural
Temporal
Logical
Coincidental
Low
SoftwareEngineering

SoftwareDesign

Slide19

Coincidental Cohesion

Functional
Sequential
Communicational
Procedural
Temporal
Logical
Coincidental

Def: Parts of the component are unrelated


(unrelated functions, processes, or data)
Parts of the component are only related by
their location in source code.
Elements needed to achieve some
functionality are scattered throughout the
system.
Accidental
Worst form

SoftwareEngineering

SoftwareDesign

Slide20

Example
1.

Print next line

2.

Reverse string of characters in second


argument

3.

Add 7 to 5th argument

4.

Convert 4th argument to float

SoftwareEngineering

SoftwareDesign

Slide21

Functional
Sequential
Communicational
Procedural
Temporal
Logical
Coincidental

Logical Cohesion

Def: Elements of component are related logically and not


functionally.

Several logically related elements are in the same


component and one of the elements is selected by the client
component.

SoftwareEngineering

SoftwareDesign

Slide22

Example

A component reads inputs from tape, disk, and


network.

All the code for these functions are in the same


component.

Operations are related, but the functions are


significantly different.

Improvement?

SoftwareEngineering

SoftwareDesign

Slide23

Temporal Cohesion

Def: Elements are related by timing involved

Elements are grouped by when they are processed.

Example: An exception handler that

Closes all open files

Creates an error log

Notifies user

Lots of different activities occur, all at same time

SoftwareEngineering

SoftwareDesign

Functional
Sequential
Communicational
Procedural
Temporal
Logical
Coincidental

Slide24

Example

A system initialization routine: this routine contains


all of the code for initializing all of the parts of the
system. Lots of different activities occur, all at init
time.
Improvement?

SoftwareEngineering

SoftwareDesign

Slide25

Procedural Cohesion

Functional
Sequential
Communicational
Procedural
Temporal
Logical
Coincidental

Def: Elements of a component are related only


to ensure a particular order of execution.
Actions are still weakly connected and unlikely
to be reusable.
Example:

...
Write output record
Read new input record
Pad input with spaces
Return new record
...

SoftwareEngineering

SoftwareDesign

Slide26

Communicational Cohesion

Def: Functions performed on the same data or to produce the


same data.

Examples:

Functional
Sequential
Communicational
Procedural
Temporal
Logical
Coincidental

Update record in data base and send it to the printer

Update a record on a database

Print the record

Fetch unrelated data at the same time.

To minimize disk access

SoftwareEngineering

SoftwareDesign

Slide27

Sequential Cohesion

Functional
Sequential
Communicational
Procedural
Temporal
Logical
Coincidental

Def: The output of one part is the input to another.

Data flows between parts (different from procedural cohesion)

Occurs naturally in functional programming languages

Good situation

SoftwareEngineering

SoftwareDesign

Slide28

Functional Cohesion

Def: Every essential element to a single


computation is contained in the component.

Every element in the component is essential


to the computation.

Ideal situation

What is a functionally cohesive component?

One that not only performs the task for which it


was designed but

it performs only that function and nothing else.

SoftwareEngineering

SoftwareDesign

Functional
Sequential
Communicational
Procedural
Temporal
Logical
Coincidental

Slide29

Examples of Cohesion
Function A
Function Function
B
C
Functio Function
n
E
D

Coincidental

Parts unrelated

logic

Function A

Time t0

Function A

Time t0 + X

Function A

Logical

Similar functions

Time t0 + 2X

Temporal

Related by time

Function A
Function B
Function C

Procedural

Related by order of functions


SoftwareEngineering

SoftwareDesign

Slide30

Examples of Cohesion (Cont.)


Function A

Function A

Function B

Function B

Function C

Function C

Communicational

Sequential

Access same data

Output of one is input to another


Function A part 1
Function A part 2
Function A part 3

Functional

Sequential with complete, related functions


SoftwareEngineering

SoftwareDesign

Slide31

GUIDELINES SUGGESTING TYPE


OF COHESION WITHIN A MODULE

If a sentence is compound sentence, if it contains comma or


it has more than one verb then the module is probably
performing more than one function so it probably has
sequential / communicational cohesion.

If a sentence contains word relating to time such as first ,


next, when and after then the module probably has
sequential or temporal cohesion.

If the predicate of sentence doesnt contain a single specific


object following the verb then the module probably has
logical cohesion.

Words like initialize and cleanup implies temporal cohesion.

SoftwareEngineering

SoftwareDesign

Slide32

Techniques for making good


design decisions

Using priorities and objectives to decide among alternatives

Step 1: List and describe the alternatives for the design


decision.

Step 2: List the advantages and disadvantages of each


alternative with respect to your objectives and priorities.

Step 3: Determine whether any of the alternatives prevents you


from meeting one or more of the objectives.

Step 4: Choose the alternative that helps you to best meet your
objectives.

Step 5: Adjust priorities for subsequent decision making.

SoftwareEngineering

SoftwareDesign

Slide33

THANKING
YOU
SoftwareEngineering

SoftwareDesign

Slide34

Вам также может понравиться