Make Your Programming Life Easier, Pseudocode

Pseudocode Is King

Sisanwunmi Agbeyegbe
The Startup
Published in
3 min readNov 9, 2020

--

When it comes to larger programming projects your code can become a monstrous behemoth, with hundreds or even thousands of lines! It can become quite difficult to keep track of it all or even understanding your thought process when looking back at it down the line.

With that being said pseudocode can be an easy way to keep track of your code.

What is Pseudocode?

Pseudocode is a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled natural language rather than in a programming language.

So pseudocode is basically an outline, written in plain English, of the code you’ll be writing. It serves as a clear explanation of the the code for anyone reading it.

Why Should You Pseudocode?

Transitioning from the structure of Ruby and Ruby on Rails into the not so straightforward style of JavaScript was a struggle for me. In trying to make my code DRY (without taking it to the extreme) and trying to limit the amount of refactoring I’d need to do later on I would get absolutely lost in my code. Keeping track of my variables and functions became a headache inducing nightmare! Leaving me with the urge to:

That’s where pseudocode (my hero 🥰) comes in!

Pseudocode helps you run through the logic needed for your program or application. When you have the chance to break it down into smaller deliverables, coding is more manageable.

One of the best parts is that it will reduce the number of bugs in your code! Yes, you read that right, pseudocode will save you time and streamline your coding process.

Ultimately, whether the idea is for a coding partner to review your code or just for a friend to learn from, pseudocode makes sharing your code simple.

How to Pseudocode

  1. Have a clear understanding of your objective: What do you need your application to do? Once you’re clear on that, then;
  2. Break it down into smaller deliverables: Create more easily. accomplished deliverables for yourself. Not only will it make it easier to write the code, it also gives you bite sized feelings of accomplishment that will fuel you as you continue programming your application.
  3. Write the accompanying code: Now that you have your bite sized deliverables it’s time to write the code that accompanies it!

That’s all there is to it, but make sure to keep your pseudocode concise. The purpose of pseudocode is to save you time, if you find yourself writing paragraphs for a single deliverable then you either need to reword it or break your deliverable up into smaller steps.

This could be you 😉

Let’s Try an Example!

Example Question: Create a method in Ruby that takes two numbers as arguments and return their sum.

1. Have a clear understanding of your objective:

  • I need to create a method, this method should take in 2 variables, I need to add them up and return the sum of the 2 variables

2. Break it down into smaller deliverables:

  • write a method: sum
  • the method takes in two variables: num1 & num2
  • add the two variables and return their sum
  • print to console

3. Write the accompanying code!

Made with repl.it

Done! This is a simple example with Ruby but when pseudocode is applied to more complex bits of code it can make your life so much easier!

Resources

--

--

Sisanwunmi Agbeyegbe
The Startup

Software Engineer👩🏾‍💻. Flatiron School Alum👩🏾‍🎓.