Software Engineering PDF
Software Engineering PDF
Organization of this
Lecture
Ñ Brief review of previous lectures
Ñ Introduction to software design
Ñ Goodness of a design
Ñ Functional Independence
Ñ Cohesion and Coupling
Ñ Function-oriented design vs. Object-
oriented design
Ñ Summary
Review of previous
lectures
ÑIntroduction to software
engineering
ÑLife cycle models
ÑRequirements Analysis and
Specification:
y Requirements gathering and
analysis
y Requirements specification
Introduction
ÑDesign phase transforms SRS
document:
y into a form easily implementable in
some programming language.
d1 d2
d3 d1 d4
High-level design
ÑUnderstandability of a design is
a major issue:
y determines goodness of design:
y a design that is easy to
understand:
xalso easy to maintain and
change.
What Is Good Software
Design?
temporal
logical
coincidental
Coincidental cohesion
search
display
Functional cohesion
data
stamp
control Degree of
coupling
common
content
Data coupling
ÑTwo modules are data coupled,
y if they communicate via a
parameter:
x an elementary data item,
xe.g an integer, a float, a character,
etc.
y The data item should be problem
related:
xnot used for control purpose.
Stamp coupling
ÑTwo modules are stamp
coupled,
y if they communicate via a
composite data item
xsuch as a record in PASCAL
xor a structure in C.
Control coupling
ÑData from one module is used
to direct
y order of instruction execution in
another.
ÑExample of control coupling:
y a flag set in one module and
tested in another module.
Common Coupling
ÑEssentially means:
ylow fan-out
yabstraction
Characteristics of Module
Structure
ÑDepth:
y number of levels of control
ÑWidth:
y overall span of control.
Ñ Fan-out:
y a measure of the number of modules
directly controlled by given module.
Characteristics of Module
Structure
ÑFan-in:
yindicates how many modules
directly invoke a given module.
yHigh fan-in represents code
reuse and is in general
encouraged.
Module Structure
Fan out=2
Fan out=1
Fan in=1
Fan in=2
Fan out=0
Goodness of Design
ÑLower-level modules:
y do input/output and other low-level
functions.
ÑUpper-level modules:
y do more managerial functions.
Abstraction
ÑThe principle of abstraction
requires:
y lower-level modules do not invoke
functions of higher level modules.
y Also known as layered design.
High-level Design
• f1
• f2
• f3 d1 d2
•
• d3 d1 d4
•
• fn
Design Approaches
ÑCreate-library-member function
consists of the following sub-
functions:
y assign-membership-number
y create-member-record
y print-bill
Function-Oriented Design
ÑEach subfunction:
ysplit into more detailed
subfunctions and so on.
Function-Oriented Design
ÑIn OOD:
y software is not developed by
designing functions such as:
xupdate-employee-record,
xget-employee-address, etc.
y but by designing objects such as:
xemployees,
xdepartments, etc.
Object-Oriented versus Function-
Oriented Design
ÑIn OOD:
ystate information is not shared
in a centralized data.
ybut is distributed among the
objects of the system.
Example:
ÑIn an employee pay-roll system,
the following can be global data:
y names of the employees,
y their code numbers,
y basic salaries, etc.
ÑWhereas, in object oriented
systems:
y data is distributed among different
employee objects of the system.
Object-Oriented versus Function-
Oriented Design
ÑObjects communicate by
message passing.
y one object may discover the state
information of another object by
interrogating it.
Object-Oriented versus Function-
Oriented Design
Ñ class detector
Ñ attributes: status, location, neighbors
Ñ operations: create, sense-status, get-
location,
Ñ find-neighbors
Ñ class alarm
Ñ attributes: location, status
Ñ operations: create, ring-alarm,
get_location,
Ñ reset-alarm
Ñ In the object oriented program,
y appropriate number of instances of the class detector
and alarm should be created.
Object-Oriented versus Function-
Oriented Design
ÑIn the function-oriented program :
y the system state is centralized
y several functions accessing these data
are defined.
Ñ In the object oriented program,
y the state information is distributed
among various sensor and alarm
objects.
Object-Oriented versus Function-
Oriented Design