Pseudo-Code — Why Writing Them?
Pseudo-code, as the name suggests, is not real code, but rather a description of what needs to be done and how. In other words, it describes the algorithmic steps that need to be taken to solve a problem.
“Problem-solving” is really the key here. Since every program can essentially be boiled down to solving a specific problem, pseudo-code can find its playground almost everywhere, as long as there are a problem and a sequence of logical steps that need to be taken to tackle the problem.
Then why not write code directly? Why even bother writing the pseudo-code?
My personal take is that we are all humans after all. Yes, the code is written for the computer to understand and execute; however, as the problem solver ourselves, we need to sort out our chaotic thoughts first, regardless of what platform and what coding languages we use.
As a developer-in-progress, I find the greatest benefit of writing pseudo-code is to OVERCOME the FEAR of CODING. The process of writing pseudo-code reminds me that I am solving a problem, rather than trying to be a perfect “computer” that writes perfect code. It gives me the chance to clarify the problem, break it down into small steps, and declutter my thoughts, making the entire coding process — surprisingly — more enjoyable than daunting.
There are many ways of writing pseudo-code, here is a flow that I personally like to follow:
- Identify (define) the variables
- Clarify the conditions (can be an Input, a value comparison, a Switch between cases, an iteration through a list or an array, etc.)
- Clarify the outcome (can be an output, a function call, etc.)