5 Ways How Pseudocode Can Boost Your Productivity


Have you ever experienced a time when you were coding up a solution only to find out midway that there is something you didn’t account for? This thing requires you to redo a lot of your work or even scrap what you have and restart over. One way avoid finding yourself in such a situation is to do pseudocode before you write a single line of code.


 

What Is Pseudocode

 

pseudocode

 

The term pseudocode in how it is used in this post is that it is something written that is not actual code in any programming languages. It is something that if anyone (technical or non-technical) would have a clear idea of what is happening. So, what this means is that pseudocode can literally be in English.

 

Let’s see an example of what I am talking about. For this example, we want to show a user a list of restaurants around them. We have a set of API (application programming interface) that provides us with a list of restaurants if we give it the location of the user. So, the pseudocode will look something like the following:

 

Obtain the location from the GPS
If location is missing, shows failure
Pass the location to the API
Process the data from the API
If the data from API is empty, let the user know there is no restaurants nearby
Otherwise, present the list of restaurants to the user

 

Notice that the pseudocode doesn’t cover the nitty-gritty details of each of the step. It serves as a high-level map of steps to solve a problem — in this case, it is to show a list of restaurants nearby.

 

1. Let’s You Communicate Ideas to Others

 

pseudocode

 

One of the biggest advantages of pseudocode is how it allows you to effectively communicate with others. With pseudocode, it is about conveying the idea without the complexity of understanding a programming language for the receiver. This means someone who is not technical can still follow the conversation.

 

Now, if you are showing pseudocode to another developer, it allows you to present the idea that you have in mind. This allows you to get quick feedback from other developers. Why is this useful? Well, let’s say you are unaware of certain limitations and roadblocks when you came up with your idea to solve a problem. Another developer who has a similar idea can let you know what issues they ran into and how they resolved them.

 

Another great use case for pseudocode is when you are doing pair programming. When you have two developers together chances are they will both have a solution to a problem. By discussing their ideas while it is in pseudocode it is easy to make changes. Maybe one sees potential issues that the other person don’t see with a certain approach. In the end, both developers will have an agreed upon approach to solving a problem.

 

2. Requires You to Think Through the Problem

 

pseudocode

 

To be able to effectively pseudocode, you need to have an idea to resolve the problem you are trying to solve. That means you at least have a high-level idea of the steps that are necessary to solve a problem. You don’t need to know the nitty-gritty details to each step, but it gives you a plan, which will increase your chance of success.

 

Another benefit is that by thinking through all that needs to be done to solve a problem, it helps you structure your code better. This is because you are designing your code for those needs upfront instead of trying to fit something midway.

 

3. Allows You to Focus on Problem Solving

 

Pseudocode helps make working with what you don’t know manageable. With pseudocode, you don’t need to worry about the syntax of a programming language or how to use a particular framework. You identify the steps to take to reach a solution and then you can research how to accomplish each step.

 

Let’s look at the restaurant nearby example from the section “What Is Pseudocode”.

 

Obtain the location from the GPS
If location is missing, shows failure
Pass the location to the API
Process the data from the API
If the data from API is empty, let the user know there is no restaurants nearby
Otherwise, present the list of restaurants to the user

 

There is a lot going on with the step to obtain the location from GPS. You will need to know how to ask the user to give your application permission to get the location and read the data from the GPS.

 

What about the step to passing the location to the API? Since it is an API call, you will want to perform it in the background. So, now you want to add threading. Since you’re threading, you will also need to know how to know when the API is done and obtain the result.

 

Much of these are technical details that will vary from the technology you are working with. However, you will notice that the general steps (pseudocode) to solving the problem remains the same. So, by approaching problems with pseudocode first you eliminate the need to worry about syntax and what you don’t know.

 

4. Helps Map a Starting Point and How to Proceed

 

So, if you haven’t noticed by now, pseudocode helps serve as a guide for you to solve a problem. You have an idea, but it’s not fully thought out. So, you organize your idea as pseudocode, so you have a high-level understanding of what needs to be done. Once you have those steps, you need to actually implement them. This involves researching, designing, and coding.

 

Something important to note is that the procedure I just described can be carried out independent of what technologies you are using. It is when you get to the implementation step do you need to factor in the technology and in some occasions make changes to the pseudocode.

 

5. Less Time Wasted

 

pseudocode

 

Pseudocode requires you to think and plan before writing a single line of code. This means the chance of running into something you didn’t consider and then having to redo or restructure your code is less frequent. Making changes to pseudocode is fast and simple while doing the same to the actual code is usually not. So, by not diving into a problem code first, you will save yourself ample time in the end by not reworking code multiple times to solve a problem.


 

I hope this post was helpful to you. If you found this post helpful, share it with others so they can benefit too.

 

Do you write pseudocode? What are your experiences with pseudocode?

 

To get in touch, you can follow me on Twitter, leave a comment, or send me an email at steven@brightdevelopers.com.


About Steven To

Steven To is a software developer that specializes in mobile development with a background in computer engineering. Beyond his passion for software development, he also has an interest in Virtual Reality, Augmented Reality, Artificial Intelligence, Personal Development, and Personal Finance. If he is not writing software, then he is out learning something new.