DEV Community

Cover image for What You Need to Know About Pseudocode
Mfon.
Mfon.

Posted on

What You Need to Know About Pseudocode

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.

How people think I code vs How I really code

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.

Flowchart of a program that checks for odd or even 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.

write-up of a program that checks for odd or even 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.

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.

  1. Take advantage of programming shorthand like IF, ELSE, ELSE IF etc.
  2. Let naming be simple and distinct.
  3. Use the correct sentence casings, such as CamelCase for methods, upper case for constants and lower case for variables.
  4. Don't overly generalize so that it does not appear abstract.

References

Top comments (4)

Collapse
 
andrewbaisden profile image
Andrew Baisden

Great article I was talking about the topic of pseudocode earlier this week.

Collapse
 
themfon profile image
Mfon.

Oh great! Please, is there a video or an article?

Collapse
 
andrewbaisden profile image
Andrew Baisden

It was Twitter 😅

Thread Thread
 
themfon profile image
Mfon.

Okay, what's your handle?! Let me check it out
😅