Лекция: Program design

Program design is the means by which proper program structure is achieved. It is the technique for going from the initial statement of the requirements of a program, which is generally vague, incomplete and contradictory, to the final structured, tested and approved code. It is a long and difficult process, made more so by the lack of widely-accepted, tested techniques of program design. However, a number of methods of program design do exist, and their use is increasing all the time. In the foreseeable future, it is likely that all software development will be based on а formal technique of program design.

The simplest and one of the most popular methods of program design is stepwise refinement. It is based on the use of algorithms, which are written in a language somewhere between English and a programming language such as Pascal. The process itself may be described by an algorithm of this nature:

State the overall steps of a program in a brief, top-level algorithm.

Repeat

Expand each statement of the algorithm as a detailed algorithm which

describes the steps required to implement the statement.

Until the task has been specified in sufficient detail for the code of the program to be written.

Stepwise refinement is a top-downprocess, with details being added in an orderly fashion as the design progresses. If an algorithm turns out to be incorrect, it can be 'unplugged' and replaced by another without too much effect on the program structure as a whole.

Although stepwise refinement can bring about a great improvement in the structure of a program, it is not formal enough for many applications. In particular, there is no guarantee that data structures are left in a consistent state by the various modules. lt is very difficult to prove the correctness of program module developed in this way.

A number of more formal methods of program design are coming into use, the most popular being functional decomposition. Like stepwise refinement, functional decomposition is a top-down method, starting with the overall requirements of a program, and adding detail in an orderly way. The difference is that at every stage, the essential properties of the data structures are specified, and each algorithm is expressed as a mathematical function which transforms these data structures. Each algorithm can be tested by various mathematical techniques, in order to prove that the properties of the data structures are not altered by the operations it performs on the data. Functional decomposition is particularly suited to some of the new functional programming languages which are being developed for fifth generation computers.

 

еще рефераты
Еще работы по информатике