Why you need to be writing pseudo code

The Update method code block, with commented code reading “game goes here”
It’s better than nothing.

My first impulse when coming up with a new idea is to dive right into the work and try to wring every last drop of juicy inspiration I can get out of the sucker. Before long, I’m elbows deep into the project and I’ve encountered three unanticipated problems — the solving of which constitutes following three separate rabbit holes. And each time I emerge from one of those convoluted warrens I have to try and reorient to the entire project and rectify the impacts of my “problem solving.”

Thankfully, I’ve learned to lend myself a helping hand through the use of pseudo code.

If you’re unfamiliar with pseudo code, this paragraph is for you; everyone else skip to the next paragraph. Pseudo code is a plain-language, detailed walkthrough of what you intend a given block of code to do. It’s essentially a sketch of your program. Let’s say you want to write the classic learner program: a tip calculator. Your pseudo code might look like the image below:

commented code block walking through the steps of calculating a tip.

Now, some might say, “Hold up, writing pseudo code is technically twice as much typing than just diving right into code!” And while that’s technically true, it’s realistically impossible to expect yourself to keep track of a highly complex issue across three or four different scripts without leaving yourself some notes.

With pseudo code you have a plan laid out. You’ve taken time to consider all the angles. You can solve a few problems before they even become problems if you take the time to lay down some //green text. Without pseudo code you may end up wasting a lot of valuable time.

Pseudo code is also helpful in team environments, especially if different team members are working in different languages. Pseudo code can quickly be adapted to any coding language.

Finally, pseudo code is right there in the same interface as your program. Some of what pseudo code does could be replaced with flowcharts or diagrams, but those tools require you to move your focus away from your coding environment.

There’s lots of reasons to use pseudo code before you code. But is pseudo code just for the planning stages of a program or script?

Not at all! You should be using pseudo code throughout the development process. Not only does this help you keep track of all the currently running threads of your project, but it leaves you with something to refer to when you haven’t touched this particular bit of code in ages. During development, you can never have too many (useful) comments.

That’s all for this article. Next time we’ll cover instantiating and destroying objects in Unity.




Unity Developer / Game Developer / Artist / Problem Solver

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Two hackathons in two weeks

20 Sprint Planning Anti-Patterns

Day 20: Adding Extras — Exiting Application

Use Amazon Cognito as an OIDC / OAuth Identity provider for API Gateway HTTP APIs JWT Authorizers

Nights Watch — Zero to Hero with AWS GuardDuty

TerraForm Enterprise (and Cloud) Variable Sets

Solr: Improving performance for Batch Indexing

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Micha Davis

Micha Davis

Unity Developer / Game Developer / Artist / Problem Solver

More from Medium

My journey becoming a Unity game developer: 2.5D

Merging the Enemy functionality

Growing Pains — From Prototype to Work of Art

Making A 2D Shooter — Staying Informed