How To Write Pseudo-code

Milecia McG on April 25, 2019

Have you ever had a really complex programming issue? An issue where you can probably write out the logic, but you aren't quite sure of the syntax ... [Read Full]
markdown guide

I usually write pseudo code first, then I code around it. The pseudo code becomes basic comments for my actual code.

I also make a simplified version with checkboxes that I put on our task manager for my superiors to see. They can then understand where I'm going with this task.

Great article !


I love reading your posts. I'm newer to programming and I appreciate how you cover a lot of things that aren't brought up in tutorials. I think pseudo-code is something I need to get in the habit of doing more. Especially if I step away from a project for awhile and come back to it.


As mentioned in another comment, I write my pseudo code as comments in my script / program and fill it in Afterwards.

So you know what you thought at this moment even a few years later.

And another people will understand what you did too :)


Thanks! I'm glad my posts are actually useful! 😊


I've been coding for about a year and a half, and today I bumped into a really complex task at work, which involved (as usual) reading another coworker's code. Luckily, I had read this post on my lunch time, and it really helped me to better understand the existing codebase (since I was able to grasp the logic behind the problem by using pseudo code). Thank you for sharing!


I'm just new to coding and I love this approach. Thank you for this post!


I also think the academic pseudo-code is interesting


Pseudo-code is a great tool for working with large code bases that you didnt write in the first place, especially if they are complex. Or your own, 6 months later after you've moved on! As a senior I'll often tell younger devs to pseudo-code a task and bring it back to me before writing code; if their pseudo-code is correct I know they understand the problem and have much higher confidence they will write correct code.


Yeah, but why not let them write real code and do a code review soon. It might cause a bit more work for you but it is safer and the junior will probably learn more. Coding is not like building a house. Code can easily be modified. Version management tools exist. Refactoring exists.


Different level of abstraction which allows for ultra efficient communication and review of logic.


This a really great post Milecia! I use pseudo code all the time and have for years, particularly on a greenfield project where I'm staring at a blank page/editor just to get mu thoughts on the page in a logical format w/o the burden of syntax, frameworks, OS, and all the other details that one must consider in coding.

Even if I have the general design in my head, there are often some complex transformation or formulae that I need to literal walk through on paper to validate my thinking and firm up the approach. It gives me the freedom to express my approach in "brain language" rather than computer language which I find very freeing.

When I learned to program the second (I learned in junior high first, then forgot most of it lol), we used a tool called an IPO chart which stood for INPUT-PROCESS-OUTPUT which had 3 columns listing basically what you'd expect, but the process was often pseudo code (sometimes flow charts but only for the handed in homework lol). I often take the same approach today and I've been coding for 37y - One is never too experienced to not need a helping hand.

Thanks again - keep posting!


I completely disagree.

Pseudocode might have made sense in the age of assembler, FORTRAN and C programming but nowadays the two main reasons for using it are probably:

  1. Not mastering your programming language.

  2. Not knowing about refactoring - nobody gets a non trivial task right at the first try. Code is not something you write once and never change it afterwards. But that's not a bad thing: Changing code is cheap if the code is clean.

Maybe there are some rare occasions where pseudocode does make sense but in most cases there are better tools to use when you are not yet ready to code: Draw diagrams write specification documents, talk to people, build a prototype, write unit tests (TDD).

What sucks most about pseudocode is that it will not provide any feedback.

Why does this matter to me after all? Because I think that it is much more helpful in the long run to put your energy into the real code.


Why did you bother posting academic pseudo code? It ruins the opportunity to share the article to someone who is learning


It's just there as another example of what pseudo-code can look like and just how complex it can be if you need it. 🙂


I see both sides here.

I appreciate seeing the more complex side, but complex pseudo-code isn’t the focus of the article, and presenting it as the first example makes the reader think the complex stuff is what pseudo-code -really- is— and that the simpler example is just “dumbed down”.

Maybe it would help if the examples were used in a different way? Like, “pseudo-code can be simple [example] or complex [example], but it’s overall goal is to...”

Thanks for the article! It answered a few questions I had 😊


Hi, nice article but I'm a beginner and I know I should nail this habit in now. I'm doing a bootcamp and the exercises are getting a bit more challenging, when I try to write pseudo code, I get trapped by 2 things. 1) I come from a more academic background, lots of essay writing, and so my pseudo code never comes out in simple digestible chunks and 2) sometimes I am not even sure how I will need to do what I need to do and so I end up just jumping right in and playing around, I never go back to writing pseudo code and if I made any attempts if offers me no guidance, because I'm like learning on the go about what works and doesn't. Any advice on how to improve on this?


I can barely remember the last time I had to write pseudo-code. Usually I did, when I had to write something really difficult to just imagine in my mind. Nowadays, the stuff I code are pretty simple


Yes, Pseudo-codes are exactly necessary initially as it would allow the team(s) to brainstorm broadly as opposed to jumping straight into code.....


Love it. Clearly is the best way to approach an algorithmic problem


What makes you think so? Does real code really suck that much? If yes, shouldn't we better find out why that is so and try to do something against it?

code of conduct - report abuse