0% found this document useful (0 votes)
549 views34 pages

Chap 2-1 Function-Oriented Design Strategy

- The document discusses functional (function-oriented) design strategies for software systems. - In functional design, the system is viewed as a collection of functions that operate on shared state. Each function transforms its inputs to outputs. - The functional design process involves data-flow design, structural decomposition of functions, and detailed design documentation. - Structural decomposition models the dynamic structure and function calls of a design using structure charts. It aims to identify loosely coupled, highly cohesive functions.

Uploaded by

Anna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
549 views34 pages

Chap 2-1 Function-Oriented Design Strategy

- The document discusses functional (function-oriented) design strategies for software systems. - In functional design, the system is viewed as a collection of functions that operate on shared state. Each function transforms its inputs to outputs. - The functional design process involves data-flow design, structural decomposition of functions, and detailed design documentation. - Structural decomposition models the dynamic structure and function calls of a design using structure charts. It aims to identify loosely coupled, highly cohesive functions.

Uploaded by

Anna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

DESIGN STRATEGIES

• 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

• Although it is sometimes suggested that one


approach to design is superior, in practice, an
object-oriented and a functional-oriented
approach to design are complementary.
• Good software engineers should select the
most appropriate approach for whatever
sub-system is being designed.
FUNCTION-ORIENTED DESIGN

Software Engineering
Ian Sommerville
Chapter 2
Objectives

• To explain how a software design may be represented as


a set of functions which share state
• To introduce notations for function-oriented design
• To illustrate the function-oriented design process by
example.
Topics covered

• 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

• Rounded rectangle - function or transform


• Rectangle - data store
• Circles - user interactions with the system
• Arrows - show direction of data flow
• keywords and/ or. Used to link data flows
Design report generator
Get design
name

Design
name
Entity
names
Design Get entity Sort entity
database names names

Sorted Produce
names Link
link report
report

Data Look up Integrate


dictionary entity names reports
and
Link
Design entity descriptions
descriptions Node
report Integrated
and report
Sort by Produce
type node report

Node Print
descriptions report
Topics covered

• Data-flow design
• Structural decomposition
• Detailed design
Structural decomposition

• Structural decomposition is concerned with developing a model of


the design which shows the dynamic structure i.e. function calls
• This is not necessarily the same as the static composition structure
• The aim of the designer should be to derive
design units which are highly cohesive and
loosely coupled
• In essence, a data flow diagram is converted to a structure chart
Decomposition guidelines
• For business applications, the top-level structure chart
may have three functions namely input, process and
output
• Data validation functions should be subordinate to an
input function
• Coordination and control should be the responsibility of
functions near the top of the hierarchy
Decomposition guidelines
• Each node in the structure chart should have between
two and seven subordinates
• The aim of the design process is to identify loosely
coupled, highly cohesive functions. Each function should
therefore do one thing and one thing only
• Cohesion – the degree to which a module performs one and only
one function.
• Coupling – the degree to which a module is connected to other
modules in the system.
Coupling and cohesion
Process steps
• Identify system processing transformations
• Transformations in the DFD which are concerned with processing rather than
input/output activities. Group under a single function in the structure chart

• Identify input transformations


• Transformations concerned with reading, validating and formatting inputs.
Group under the input function

• Identify output transformations


• Transformations concerned with formatting and writing output. Group under
the output function
Initial structure chart
Produce
design report s
entity entity
names data
entity entity
names data

Get design Collate Gener ate


entity names entities repor t

Design Design Design


name entity repor t
names
Expanded structure chart
Produce
design repor ts
sorted
names sorted entity
names data
entity
data

Get design Collate Gener ate


entity names entities repor t

sor ted sor ted


entity names entity entity
design names data data
name sor ted entity Integ a
r ted
names data repor t
Get design Get entity Sort entities Get entity Sort entities Produce Print
name names by name data by type integ rated repor t report

design entity entity repor t


name names data
Final structure chart
Produce
design repor ts
sorted
entity
names sorted
names data
entity
data

Get design Collate Gener ate


entity names entities report

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

Transform name: Sort entity names (Namelist: in out Names)

Description: This transform takes a list of entity names and


sorts them into ascending alphabetical order.
Data
dictionar y Duplicates are removed from the list.

It is anticipated that the names will be randomly ordered and


that a maximum of 200 names need be sorted at one time.
A quicksort algorithm is recommended.
Other traditional design practices

• 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

• Data-flow diagrams are a means of documenting end-to-


end data flow. Structure charts represent the dynamic
hierarchy of function calls
• Data flow diagrams can be implemented directly as
cooperating sequential processes

You might also like