Software Design
Software Design
Introduction
• Design phase transforms SRS document:
– To a form easily implementable in some
programming language.
• Module structure,
• Control relationship among the modules
– call relationship or invocation relationship
• Interface among different modules,
– Data items exchanged among different modules,
• Data structures of individual modules,
• Algorithms for individual modules.
Module Structure
Introduction
• A module consists of:
– Several functions
– Associated data structures.
D1 ..
D2 .. Data
D3 ..
F1 .. Functions
F2 ..
F3 ..
F4 ..
F5 ..
Introduction
• Good software designs:
– Seldom arrived through a single step
procedure:
– But through a series of steps and
iterations.
Introduction
• Design activities are usually classified into two
stages:
– Preliminary (or high-level) design.
– Detailed design.
• Meaning and scope of the two stages:
– Vary considerably from one methodology to
another.
High-Level Design
• Identify:
– Modules
– Control relationships among modules
– Interfaces among modules.
d1 d2
d3 d1 d4
High-Level Design
• The outcome of high-level design:
– Program structure (or software
architecture).
High-Level Design
• Several notations are available to represent
high-level design:
– Usually a tree-like diagram called
structure chart is used.
– Other notations:
• Jackson diagram or Warnier-Orr
diagram can also be used.
Detailed Design
• For each module, design:
–Data structure
–Algorithms
• Outcome of detailed design:
–Module specification.
A Classification of Design Methodologies
• Fan-in:
–Indicates how many modules
directly invoke a given module.
–High fan-in represents code reuse
and is in general encouraged.
Module Structure
Fan out=2Fan in=0
Fan out=1
Fan in=1
Fan in=2
Layered Design
• A design having modules:
–With high fan-out numbers is not a
good design:
–A module having high fan-out lacks
cohesion.
Goodness of Design
• A module that invokes a large
number of other modules:
– Likely to implement several different
functions:
– Not likely to perform a single
cohesive function.
Control Relationships
• A module that controls another module:
– Said to be superordinate to it.
• Conversely, a module controlled by
another module:
– Said to be subordinate to it.
Visibility and Layering
•
• d3 d1 d4
•
• fn
Design Approaches
• Two fundamentally different software
design approaches:
– Function-oriented design
– Object-oriented design
Design Approaches
• These two design approaches are
radically different.
– However, are complementary
• Rather than competing techniques.
– Each technique is applicable at
• Different stages of the design process.
Function-Oriented Design
• A system is looked upon as something
– That performs a set of functions.
• Starting at this high-level view of the system:
– Each function is successively refined into more
detailed functions.
– Functions are mapped to a module structure.
Example
• The function create-new-library-
member:
– Creates the record for a new member,
– Assigns a unique membership number
– Prints a bill towards the membership
Example
• Create-library-member function
consists of the following sub-functions:
– Assign-membership-number
– Create-member-record
– Print-bill
Function-Oriented Design
• Each subfunction:
– Split into more detailed subfunctions
and so on.
Function-Oriented Design
• The system state is centralized:
– Accessible to different functions,
– Member-records:
• Available for reference and updation to several
functions:
– Create-new-member
– Delete-member
– Update-member-record
Function-Oriented Design
• Several function-oriented design approaches
have been developed:
– Structured design (Constantine and Yourdon, 1979)
– Jackson's structured design (Jackson, 1975)
– Warnier-Orr methodology
– Wirth's step-wise refinement
– Hatley and Pirbhai's Methodology
Object-Oriented Design
• System is viewed as a collection of
objects (i.e. entities).
• System state is decentralized among
the objects:
– Each object manages its own state
information.
Object-Oriented Design Example
• Library Automation Software:
– Each library member is a separate object
• With its own data and functions.
– Functions defined for one object:
• Cannot directly refer to or change data of
other objects.
Object-Oriented Design
• Objects have their own internal data:
– Defines their state.
• Similar objects constitute a class.
– Each object is a member of some class.
• Classes may inherit features
– From a super class.
• Conceptually, objects communicate by message
passing.
Object-Oriented versus Function-Oriented
Design
• In OOD:
– State information is not shared in a
centralized data.
– But is distributed among the objects of
the system.
Example:
• In an employee pay-roll system, the
following can be global data:
– employee names,
– code numbers,
– basic salaries, etc.
• Whereas, in object oriented design:
– Data is distributed among different employee
objects of the system.
Object-Oriented versus Function-Oriented
Design