An essential part of the design process when developing computer software is to work out what the program code will do. There are a number of methods and techniques to help but one of the most straightforward to use and easiest to understand is using pseudocode. Pseudocode is also known as an algorithm or Structured English.
The dictionary.com definition for an algorithm is "a set of rules for solving a problem in a finite number of steps" and this is precisely what program code does. Pseudocode is produced by writing down a sequence of steps that will meet the program requirement. It is called pseudocode because it is almost programming code - but not quite - using a mixture of English and code-like statements rather than actual program code.
Pseudocode makes use of programming control structures (sequence, repetition and selection), which means it can then be used as a guide to produce the actual program. It may also include information about the data required (for example, variable names and types) and output to be produced (for example, report formats).
Pseudocode is Useful
There are many reasons given for using pseudocode, which makes it worthwhile to understand exactly how it can help:
- Algorithms and pseudocode can be used to code in any programming language.
- Pseudocode and Structured English is easier to read and understand than reading program code direct, especially for less experienced programmers or people learning a new programming language.
- Writing down what needs to be done before starting to code reduces the total software development time. It is more efficient to write pseudocode and then produce code, rather than start with coding.
- When coding a complex algorithm, pseudocode can be used to check the method is correct with a non-technical person as Structured English should make sense to everyone. For example when producing a set of figures using data which can be interpreted a number of different ways, it is helpful to check the pseudocode with the person who asked for the program to be developed.
- The Structured English can used as comments in the program code.
These points support using pseudocode to increase the quality of program code, as it helps ensure user requirements are met and that program code meets good software development practice.
There are Downsides to Using Pseudocode
It is not always appropriate to use Pseudocode and there are arguments against using it:
- Pseudocode takes time to produce and if a relatively straightforward program is being written by an experienced programmer it won’t be necessary.
- Pseudocode is language independent, so doesn’t allow all features of a language (or a particular system) to be exploited – sometimes pseudocode can be written one way and then programmed more easily and efficiently another way.
There are more reasons for using pseudocode than against and it is definitely worth investing time to understand what it is and how to produce it.
Join the Conversation