The data structure design is a method that starts with the specification of the program (what the program does) and leads to the detailed program design expressed in the form of pseudo-code.
This method is variably referred to as the ‘Michael Jackson program design method’ after the name of its inventor ‘Michael Jackson’. Sometimes, we refer to it as ‘Jackson Structured Programming (JSP)’ or ‘data structure design’.
Content: Data Structure Design in Software Engineering
- Basic Concept
- Example of Data Structure Design
- Steps for Data Structure Design
- Processing Input Files
- Diagrammatic Notations
- Aspects of Data Structure Design
The structure of the program must match the structure of the data (input and output data) that the program has to work upon.
To understand this in a better way let’s go through an example.
Example of Data Structure Design
Specification of the Program – Consider a program that prints a bank statement.
Data – The bank statement is printed on the number of pages of the passbook. Now a passbook page has a heading at the top (date, description, withdrawals, deposits and balance) followed by a series of bank statements showing the transactions ended with a summary line.
Now we know the specification of the program and the data (input and output data) it has to act on. So, with some programming experience, we can say the program needs:
- Separate statements to print the heading, transaction line and summary line.
- Loop statements to print the number of pages.
- Loop statement to print transaction lines on the number of pages.
Notice that the program structure that we just describe matches the structure of the data. This example shows how we have produced a program structure using the program specification and structure of its data.
Steps for Data Structure Design
As discussed, the program structure depends on the structure of the files that it will use. The structure design method first creates the diagrammatic representation of files used and programs. Further, convert these diagrammatic representations to a pseudo code. Steps for the same are:
- Draw the diagrammatic representations of the data structures (input and output) that the program is going to use.
- Incorporate all the data structure diagrams and derive a single program structure diagram.
- Identify and note down the operations that the program will carry out.
- Associate these identified operations to the program structure diagram. Position these operations at their specific position in the program.
- Converts this program structure diagram into the pseudo-code.
We will go through these steps in the section below.
Processing Input Files
We can use the data structure design methods to design the structure of the program where the data is inside the file. In the example below, we will see how this method processes the file’s information.
Consider that a file has a number of records where each record describes details of a person.
Specification of the Program – Design a program that will process these records from the input file and count the number of males and females.
Structure of Data
- Input- File consisting of records
- Output – Male Count and Female count
Knowing the specification of the program and the structure of data let’s draw a data structure diagram for this program:
Now with the data structure diagram let us design the pseudo-code.
while not end of file (eof)
if record = male
then increment male count
else increment female count
You can notice that the boxes with the alternative make ‘if-then-else‘ statement. But overviewing the data structure diagram you can not realize that we would require the read record statements.
So, the data structure diagram only provides the basic structure of the program. Further, we have to add the elementary operations to it so as to provide the fine details.
Multiple Input and Output Files
It is not always the case that the program will have a single input and single output stream. In most common situations, there are multiple input and output streams.
The design method is the same here. We must ensure that we describe the structure of all the input and output streams in the program structure.
To design the program structure first we need to draw the data structure diagram for each input and output stream. Then incorporate all aspects of all the data structure diagrams to design the final program structure diagram. Later convert it to the pseudo-code.
In some of the cases, you can not map all the data structures (input and output structures) onto a single program structure. This we term as structure clash in data structure program design.
The data structure diagram above has the following diagrammatic notations:
- Consist of – It is indicated by a line between two boxes which means the upper box consists of the lower box. Like in the figure above we can say the file body consists of records which further consist of male and female records.
- Sequence – The boxes at the same level denote sequencing. The left-most box is followed by the right one. Like in the above diagram the file body is followed by the end of the file (eof).
- Repetition – The box with a star denotes the repetition of the content. Like the file body, consists of a record that is repeated zero or more times.
- Letter ‘o’ – The box with the letter o indicates the alternatives.
Thus, we have used all the notation sequence, selection, repetition, and hierarchy with the above data structure diagram.
Aspects of Data Structure Design
The basic principle behind the data structure design method is:
Thus, we can state that the structure of a program is dictated by the structure of its input and output data. Well, this statement concludes with a strong statement:
So, this method produces the best program design and creates the right program design.
The structure of the program and the structure of data must be proximate to each other. So that the small change in the structure of data (structure of input and output file) demands a small change in the structure of the program. And if there is a large change in the structure of data there must be a large change in the structure of the program.
The amount of effort required in the maintenance of the program also depends on the extent of the requested changes. Some users do not understand this and are not aware of the trials involved in modifying programs. So, sometimes what they perceive as a small change to a program takes a long (in terms of time and cost) to implement by the developer.
2. Degree of Systematization
The data structure design method is the most systematic form of designing a program. This systematization can be counted on the following parameters:
- Non-Inspirational: The data structure design method is non-inspirational i.e. it is little affected by any invention.
- Rational: The method is reasonable as the reason behind it is that the structure of the data dictates the program’s structure.
- Teachable: The method can be taught easily as it consists of well-defined steps.
- Consistent: Even if the two different people are given the program’s specification, they will come out with the same program design.
- Simple and easy to use.
- The program design produced with this method can be implemented in any programming language.
The data structure design is applicable for most applications where the structure of the input and output data is quite clear and evident. In case, the data is not evident then the data structure design method doesn’t apply.
Let us understand this with the help of an example. There is a program to calculate the square root of a number. Let’s see how useful this method is to design this computational method.
The input and output data to this program has a very simple structure. Both are merely a single number. But this doesn’t provide any detailed information about how a program must be structured. It does not even guide if any iterative algorithm has to be designed that would calculate the successive better and better approximation to this calculation.
So here, the structure of the input and output data doesn’t dictate the structure of the program. Thus, the data structure design method is not applicable in designing this program.
4. Role of Data Structure Design
The data structure design method is most commonly used in serial file processing.
A serial file is one where the information is stored in the order it occurred. The serial file can also contain files in the order they are saved to the serial file. Examples of serial files are graphic files, sound files, files sent to the printers, etc.
So, this is all about the data structure design method. Here, we derive the program structure from the data (input and output) it acts upon. And then we convert this structure to a pseudo-code design.
Leave a Reply