Why you need to be writing pseudo code

Joe

--

First lets start out with defining what pseudo code is. The idea behind pseudo code is fairly easy to understand. Pseudo code is simply an implementation of code in the form of annotations and informative text written in plain language. It does not have all the formal syntax like the programming language and thus can’t be compiled or interpreted by the computer.

This means that as part of the development process each intended line of code can be written out in whatever language is most comfortable, be that English, French, or some other language. This will get the idea out quickly and easily. Doing this can also assist with thinking through the logic of what the code should be doing.

There are no industry defined standards on writing pseudo code, but it should describe what needs to happen so that anyone would be able to understand what that piece of code will be doing. Even if the reader does not have a technical background.

Writing pseudo code can also be used as a basis for documentation of the code. Just as it helps as a bridge between natural language and programming code, it can help as a starting point for writing technical documentation about what the code is doing.

So in short pseudo code should be written as a stepping stone to get the idea out and written down without the need to worry about all the intricacies of coding. This will brings focus to the idea/problem at hand. Then later the pseudo code can be change into code and the details of the coding language can be focused on at that time.

A quick example of pseudo code to check if a coin is heads or tails.

 If coin is heads
print result to console
“Coin is heads.”
If coin is tails
print result to console
“Coin is tails.”

Best Practices for writing Pseudo Code

  1. Use appropriate naming conventions. The human tendency is to follow the approach we see. If a programmer goes through pseudo code, their approach will be the same as it, so keep the naming simple and distinct.
  2. Use appropriate casings, such as CamelCase for methods, upper case for constants and lower case for variables.
  3. Use proper indentation and use of whitespace, as it helps to identify and understand the decision control and execution mechanism. It also helps to greatly improve the readability.
  4. Explain everything that is going to happen in the actual code. Don’t make the pseudo code abstract.
  5. Use standard programming structures such as ‘if-then’, ‘for’, ‘while’, ‘cases’ the way it is used in programming.
  6. Check whether all the sections of the pseudo code are complete, finite and clear to understand.
  7. Don’t write the pseudo code in a completely programmatic manner. It is necessary to be simple enough to understand even for a layman or client, so don’t incorporate too many technical terms.

--

--