Pseudocode for Beginner Programmers: What it is and Why You Should Use it.

Ryan Flynn
3 min readJul 24, 2020

--

Introduction

If you ever looked at an algorithm or even came across someone else’s code tutorial, you may have encountered the seemingly daunting idea of pseudocode. As a beginner programmer it is hard enough to communicate using code, so it is typical that when new programmers see pseudocode, they get quite confused. However, pseudocode is meant to be a help and not a hindrance. So that’s why I created a quick guide to show beginner programmers how to use pseudocode, and why you want to be familiar with it.

What is Pseudocode?

Pseudocode is a way of writing code that does not rely on a particular syntax or programming language. This means that pseudocode is the stuff you write out before you tackle a difficult problem. If you are a beginner programmer, you have probably needed to write out the problem in layman’s terms first to truly grasp it. If so congrats! You have already written some basic pseudocode.

Want to read this story later? Save it in Journal.

How Should I Use It?

Although, your quick scribbles on a notepad may be helpful for you. They are most likely unreadable to someone else. That’s why you want to make sure that your pseudocode is both written methodically, and consistently. One convention I usually stick to in order to satisfy both of these conditions is to capitalize my keywords like so:

Notice how I also put the basic terms INPUT and OUTPUT instead of something like “print” or “puts”. This is because when you write pseudocode you also want to write it so that it can be understood by any developer. This means that someone who only knows ruby could understand this just as much as someone who only knows Java and so on. So, as a good pseudocode programmer I made sure that I wrote my input and output without syntax so that it is accessible to all programmers.

Why Should I Use It?

You might be asking, but Ryan why should I use pseudocode? Well pseudocode is a fantastic way to tackle hard and scary algorithms. Let’s say we want to create a simple ruby program that gives us a Tribonacci value based on the number we pass in. Here is a link to the Tribonacci Sequence if you never heard of it before. Well I would most likely write my pseudocode like so:

This does two things for me. One it simplifies the problem without having to worry about boilerplate code and syntax. And two it makes it so that my friend Steve can understand my logic without having to learn ruby. Now that we have our pseudocode, the next step is to write my ruby code based on the logic I just wrote like so:

Conclusion

And that’s it! You have just learned how to write some basic pseudocode. Now if you are in an interview situation, or if you are just trying to explain something to a developer who doesn’t know your programming language, you can use pseudocode to look like a super star. Good luck and happy coding!

Sources:

https://brilliant.org/wiki/tribonacci-sequence/

http://www.mattmorgante.com/technology/algorithms

https://www.youtube.com/watch?v=preyTbKXDoQ&t=1016s

https://www.geeksforgeeks.org/how-to-write-a-pseudo-code/

📝 Save this story in Journal.

👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. Read the Noteworthy in Tech newsletter.

--

--

Ryan Flynn
Ryan Flynn

Written by Ryan Flynn

Learning too many things at the same time

Responses (1)