Programming Fundamentals/Pseudocode
Overview
[edit | edit source]Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm.[1]
Discussion
[edit | edit source]Pseudocode is one method of designing or planning a program. Pseudo means false. Thus, pseudocode means false code. Pseudocode is a simplified programming language that describes a program in lay terms. It uses English statements to describe what a program is to accomplish. Pseudocode is used for documenting the program or module design (also known as the algorithm).
The following outline of a simple program illustrates pseudocode. We want to be able to enter the ages of two people and have the computer calculate their average age and display the answer.
Outline using Pseudocode
Input display a message asking the user to enter the first age get the first age from the keyboard display a message asking the user to enter the second age get the second age from the keyboard Processing calculate the answer by adding the two ages together and dividing by two Output display the answer on the screen pause so the user can see the answer
After developing the program design, we use the pseudocode to write code in a language (like C++, Java, Python, etc.) where you must follow the rules of the language (syntax) to code the logic or algorithm presented in the pseudocode. Pseudocode usually does not include other items produced during programming design, such as identifier lists for variables or test data.
There are other methods for planning and documenting the logic of a program. One method is HIPO. It stands for Hierarchy plus Input Process Output and was developed by IBM in the 1960s. It involved using a hierarchy (or structure) chart to show the relationship of the sub-routines (or functions) in a program. Each sub-routine had an IPO piece. Since the above problem/task was simple, we did not need to use multiple sub-routines. Thus, we did not produce a hierarchy chart. We did incorporate the IPO part of the concept for the pseudocode outline.
Key Terms
[edit | edit source]- pseudo
- Means false and includes the concepts of fake or imitation.