21.08.2013 Views

Software Engineering for Students A Programming Approach

Software Engineering for Students A Programming Approach

Software Engineering for Students A Programming Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER<br />

8 Functional<br />

decomposition<br />

This chapter explains:<br />

■ how to use functional decomposition<br />

■ the principles behind the method.<br />

8.1 ● Introduction<br />

Functional decomposition is a technique <strong>for</strong> designing either the detailed structure or the<br />

large-scale structure of a program or module. As its name suggests, functional decomposition<br />

is a method that focuses on the functions, or actions, that the software has to carry<br />

out. To use the method we first write down, in English, a single-line statement of what the<br />

software has to do. If the software per<strong>for</strong>ms several functions (as most GUI-driven software<br />

does) write down a single line <strong>for</strong> each function. For example, suppose we want to write a<br />

program to direct a robot to make a cup of instant coffee. We could begin by writing:<br />

make a cup of coffee<br />

Then we express the problem solution in terms of a sequence of simpler actions:<br />

boil water<br />

get a cup<br />

put coffee in cup<br />

add water<br />

add milk<br />

add sugar to taste<br />

Next we take each of these statements and write down what it does in greater detail.<br />

This process of decomposition or refinement is continued until the solution is expressed<br />

in sufficient detail. Usually this is when the solution corresponds to the statements<br />

provided by the programming language to be used.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!