Many non-tech people think that software engineers solve problems by opening their software and spending hours clacking their keyboards. They think of it as something that requires no stress at all. If wishes were horses, software engineers would clack endlessly!
Software engineers spend most of their time analysing problems and breaking them down into smaller bits. They need to create solutions and understand the structure of the code before any line of code is written in any programming language(s).
They create these solutions using pseudocode.
What is Pseudocode?
Pseudocode means fake code. It is simply writing out algorithms without strictly adhering to the syntax rules of any programming language. You do not need to worry about technicalities. However, ensure that any programmer can understand it.
Uses of Pseudocode
- To plan programmes
- To reduce coding errors
- To enable a smooth development process
Forms of Pseudocode
There are many forms of Pseudocode, but I will consider three.
- Flowchart Method: This is the graphical illustration of an algorithm. It uses connected symbols to show the flow of a process. Software engineers use this method to think through the process of a particular function.
The diagram below is the flowchart of an algorithm that checks for even or odd numbers.
- Write-up Method: This type of pseudocode uses more words. Software engineers use this method to think through the chronological process of code.
The snapshot below is the write-up pseudocode of an algorithm that checks for even or odd numbers.
- Functionality Planning Method: This involves writing out the main features you want your users to have when using your programme, including functions and smaller programmes you need to make those features work. This method is a notch higher than the flowchart method.
The snapshot below is the functionality planning pseudocode of a banking programme.
Rules of Pseudocode
Yes! Rules! Whereas there are no strict rules guiding the use of pseudocode, there are some salient points to note, so the whole purpose is not defeated.
- Take advantage of programming shorthand like IF, ELSE, ELSE IF etc.
- Let naming be simple and distinct.
- Use the correct sentence casings, such as CamelCase for methods, upper case for constants and lower case for variables.
- Don't overly generalize so that it does not appear abstract.