Sei sulla pagina 1di 3

Degree of systematization

The data structure design method can reasonably claim to be the most systematic
program
design method currently available. It consists of a number of distinct steps, each
of which produces a definite piece of paper. The following claims have been made
of
the method:
_ non-inspirational use of the method depends little or not at all on invention or
insight
_ rational it is based on reasoned principles (structured programming and
program
structure based on data structure)
10.6 _ Discussion
10.6 Discussion 135
_ teachable people can be taught the method because it consists of well-defined
steps
_ consistent given a single program specification, two different people will come
up
with the same program design.
_ simple and easy to use
_ produces designs that can be implemented in any programming language.
While these characteristics can be regarded as advantages, they can also be seen as
a
challenge to the traditional skills associated with programming. It is also highly
contentious
to say that data structure design is completely non-inspirational and rational.
In particular, some of the steps arguably require a good deal of insight and
creativity,
for example, drawing the data structure diagram, identifying the elementary
operations
and placing the operations on the program structure diagram.
Applicability
Data structure design is most applicable in applications where the structure of the
(input or output) data is very evident. Where there is no clear structure, the method
falls down.
For example, we can assess how useful this method is for designing computational
programs by considering an example. If we think about a program to calculate the
square root of a number, then the input has a very simple structure, and so has the
output.
They are both merely single numbers. There is very little information upon which

to base a program structure and no guidance for devising some iterative algorithm
that
calculates successively better and better approximations to the solution. Thus it is
unlikely that data structure design can be used to solve problems of this type.
The role of data structure design
Data structure designs strong application area is serial file processing. Serial files
are widely
used. For example, graphics files (e.g. JPEG and GIF formats), sound files (e.g.
MIDI),
files sent to printers (e.g. PostScript format), Web pages using HTML, spreadsheet
files
and word processor files. Gunter Borns book (see Further Reading) lists hundreds
of
(serial) file types that need the programmers attention. So, for example, if you
needed to
write a program to convert a file in Microsoft format to an Apple Macintosh
format, data
structure design would probably be of help. But perhaps the ultimate tribute to the
method is the use of an approach used in compiler writing called recursive descent.
In
recursive descent the algorithm is designed so as to match the structure of the
programming
language and thus the structure of the input data that is being analyzed.
The main advantages of data structure design are:
_ there is high proximity between the structure of the program and the structure
of
the files. Hence a minor change to a file structure will lead only to a minor change
in the program
_ a series of well-defined steps leads from the specification to the design. Each
stage
creates a well-defined product.
136 Chapter 10 _ Data structure design
10.1 Design a program to display a multiplication table such as young children use.
For
example, the table for numbers up to 6 is:
123456
1123456
2 2 4 6 8 10 12
3 3 6 9 12 15 18
4 4 8 12 16 20 24

5 5 10 15 20 25 30
6 6 12 18 24 30 36
The program should produce a table of any size, specified by an integer input from
a
text box. (The structure of the input is irrelevant to this design.)
10.2 A data transmission from a remote computer consists of a series of messages.
Each
message consists of:
1. a header, which is any number of SYN bytes
Summary
The basis of the data structure method is that the structure of a program can be
derived from the structure of the files that the program uses. The method uses a
diagrammatic
notation for file and program structures. Using these diagrams, the method
proceeds step by step from descriptions of the file structures to a pseudo-code
design.
The steps are:
1. draw a diagram (a data structure diagram) describing the structure of each of
the files that the program uses.
2. derive a single program structure diagram from the set of data structure
diagrams.
3. write down the elementary operations that the program will have to carry out.
4. associate the elementary operations with their appropriate positions in the
program
structure diagram
5. transform the program structure diagram into pseudo-code.
In some cases, a problem exhibits an incompatibility between the structures of
two of its inputs or outputs. This is known as a structure clash. The method
incorporates
a scheme for dealing with structure clashes.

Potrebbero piacerti anche