Professional Documents
Culture Documents
à
2 Brief review of previous lectures
2 Introduction to software design
2 Goodness of a design
2 Functional Independence
2 Cohesion and Coupling
2 Function-oriented design vs. Object-
oriented design
2 Summary
a
2Introduction to software
engineering
2Life cycle models
2Requirements Analysis and
Specification:
Requirements gathering and
analysis
Requirements specification
M
2esign phase transforms SRS
document:
into a form easily implementable in
some programming language.
m m
M
2 module structure,
2 control relationship among the modules
call relationship or invocation relationship
2 interface among different modules,
data items exchanged among different
modules,
2 data structures of individual modules,
2 algorithms for individual modules.
m
M
2A module consists of:
several functions
associated data structures.
M
2Good software designs:
seldom arrived through a single
step procedure:
but through a series of steps and
iterations.
M
2 esign activities are usually classified
into two stages:
preliminary (or high-level) design
detailed design.
2 Meaning and scope of the two stages:
vary considerably from one methodology to
another.
`
2 Identify:
modules
control relationships among modules
interfaces among modules.
d d
d d d
`
2Understandability of a design is
a major issue:
determines goodness of design:
a design that is easy to
understand:
also easy to maintain and
change.
uM { m
d
!
d
#
d
2wo modules are data coupled,
if they communicate via a
parameter:
an elementary data item,
e.g an integer, a float, a character,
etc.
he data item should be problem
related:
not used for control purpose.
m
2wo modules are stamp
coupled,
if they communicate via a
composite data item
such as a record in PASCAL
or a structure in C.
!
2ata from one module is used
to direct
order of instruction execution in
another.
2Example of control coupling:
a flag set in one module and
tested in another module.
! !
2Essentially means:
low fan-out
abstraction
!
m
2epth:
number of levels of control
2Width:
overall span of control.
2 Fan-out:
a measure of the number of modules
directly controlled by given module.
!
m
2Fan-in:
indicates how many modules
directly invoke a given module.
`igh fan-in represents code
reuse and is in general
encouraged.
m
{
2Lower-level modules:
do input/output and other low-level
functions.
2Upper-level modules:
do more managerial functions.
3
2he principle of abstraction
requires:
lower-level modules do not invoke
functions of higher level modules.
Also known as layered design.
`
r
r d d
r
r
r d d d
r
r
3
2Create-library-member function
consists of the following sub-
functions:
assign-membership-number
create-member-record
print-bill
#
à
2Each subfunction:
split into more detailed
subfunctions and so on.
#
à
2In OO:
software is not developed by
designing functions such as:
update-employee-record,
get-employee-address, etc.
but by designing objects such as:
employees,
departments, etc.
à$à
#
à
2In OO:
state information is not shared
in a centralized data.
but is distributed among the
objects of the system.
£
2In an employee pay-roll system,
the following can be global data:
names of the employees,
their code numbers,
basic salaries, etc.
2Whereas, in object oriented
systems:
data is distributed among different
employee objects of the system.
à$à
#
à
2Objects communicate by
message passing.
one object may discover the state
information of another object by
interrogating it.
à$à
#
à
/* alarm activated when status set */
/* room number where alarm is located */
!
!!
!
"!
#!!$!
%
!
$
à$à
3
2 class detector
2 attributes: status, location, neighbors
2 operations: create, sense-status, get-
location,
2 find-neighbors
2 class alarm
2 attributes: location, status
2 operations: create, ring-alarm,
get_location,
2 reset-alarm
2 In the object oriented program,
appropriate number of instances of the class detector
and alarm should be created.
à$à
#
à
2In the function-oriented program :
the system state is centralized
several functions accessing these data
are defined.
2 In the object oriented program,
the state information is distributed
among various sensor and alarm
objects.
à$à
#
à