Chap 2-1 Function-Oriented Design Strategy
Chap 2-1 Function-Oriented Design Strategy
• Functional design
• The system is designed from a functional viewpoint. The system
state is centralized and shared between the functions operating
on that state.
• Object-oriented design
• The system is viewed as a collection of interacting objects.
The system state is decentralized and each object manages its
own state. Objects may be instances of an object class and
communicate by exchanging methods.
Mixed-strategy Design
Software Engineering
Ian Sommerville
Chapter 2
Objectives
• Data-flow design
• Structural decomposition
• Detailed design
• A comparison of design strategies
Function-oriented design
• Design with functional units which transform inputs to outputs
• Practised informally since programming began
• Thousands of systems have been developed
using this approach
• Supported directly by most programming
languages
• Most design methods are functional in their
approach
A function-oriented view of design
Shared memory
F1 F2 F3
F4 F5
Natural functional systems
• Some systems are naturally function-oriented
• Systems which maintain minimal state
information i.e. where the system is concerned with
processing independent actions whose
outcomes are not affected by previous actions
• Information sharing through parameter lists
• Transaction processing systems fall into this category. Each
transaction is independent
loop
ATM software design
loop
Print_input_message (” Welcome - Please enter your card”) ;
exit when Card_input ;
end loop ;
Account_number := Read_card ;
Get_account_details (PIN, Account_balance, Cash_available) ;
if Validate_card (PIN) then
loop
Print_operation_select_message ;
case Get_button is
when Cash_only =>
Dispense_cash (Cash_available, Amount_dispensed) ;
when Print_balance =>
Print_customer_balance (Account_balance) ;
when Statement =>
Order_statement (Account_number) ;
when Check_book =>
Order_checkbook (Account_number) ;
end case ;
Eject_card ;
Print (“Please take your card or press CONTINUE”) ;
exit when Card_removed ;
end loop ;
Update_account_information (Account_number, Amount_dispensed) ;
else
Retain_card ;
end if ;
end loop ;
Functional and object-oriented design
• For many types of application, object-oriented design is
likely to lead to a more reliable and maintainable system
• Some applications maintain little state – function-oriented
design is appropriate
• Standards and methods for functional design are well-
established
• Existing systems must be maintained – function-oriented
design will be practised well into the future
Functional design process
• Data-flow design
• Model the data processing in the system using data-flow diagrams
• Structural decomposition
• Model how functions are decomposed to sub-functions using graphical
structure charts
• Detailed design
• The entities in the design and their interfaces are described in detail.
These may be recorded in a data dictionary and the design expressed
using a PDL
Topics covered
• Data-flow design
• Structural decomposition
• Detailed design
Data flow diagrams
• Show how an input data item is functionally
transformed by a system into an output data
item
• Are an integral part of many design methods
• May be translated into either a sequential or
parallel design. In a sequential design,
processing elements are functions or
procedures; in a parallel design, processing
elements are tasks or processes
DFD notation
Design
name
Entity
names
Design Get entity Sort entity
database names names
Sorted Produce
names Link
link report
report
Node Print
descriptions report
Topics covered
• Data-flow design
• Structural decomposition
• Detailed design
Structural decomposition
sorted sorted
entity names entity entity
names data data
design
name sorted entity Integ ated
r
names data report
Get design Get entity Sor
t entities Get entity Sort entities Produce Print
name names by name data by type integated
r repor t report
Node
design design entity entity entity Link data Node
name name names name data data
repor t
Link repor t
Design Data Produce repor t Produce
database dictionar y link repor t node repor t
Topics covered
• Data-flow design
• Structural decomposition
• Detailed design
Detailed design
• Concerned with producing a short design specification
(minispec) of each function. This should describe the
processing, inputs and outputs
• These descriptions should be managed in a data
dictionary
• From these descriptions, detailed design descriptions,
expressed in a PDL or programming language, can be
produced
Data dictionary entries
Entity name Type Description
Design name STRING The name of the design assigned by the
design engineer.
Get design name FUNCTION Input: Design name
Function: This function communicates
with the user to get the name of a design
that has been entered in the design
database.
Output: Design name
Get entity names FUNCTION Input: Design name
Function: Given a design name, this
function accesses the design database to
find the names of the entities (nodes and
links) in that design.
Output: Entity names
Sorted names ARRAY of A list of the names of the entities in a
STRING design held in ascending alphabetical
order.
Design entity information
Get design
name Design
name
Entity
names
Design Get entity Sort entity
database names names
• Stepwise refinement
• Structured Systems Analysis and Structured Design
(SSA/SD)
• Jackson System Development (JSD)
Stepwise refinement
• Creator: Niklaus Wirth
• Historically, this is the first “design method”.
• A top-down process of successive refinement of specifications.
• Program construction consists of a sequence of refinement steps, where a
task is divided into subtasks.
• Strengths:
• Simplicity of the process.
• Stepwise nature encourages an orderly development of ideas and also a means
of backtracking.
• Weaknesses:
• Potential problems with top-down approach which decides on a particular
hierarchy early in the project.
• Lack of a stopping rule.
• Duplication of lower-level units.
Top-down decomposition
Example: Entity structure diagram
Book
Key points
• Function-oriented design relies on identifying functions
which transform inputs to outputs
• Many business systems are transaction processing
systems which are naturally functional
• The functional design process involves identifying data
transformations, decomposing functions into sub-
functions and describing these in detail
Key points