Why you should be writing pseudo code

Ian Plumpton
2 min readMay 7, 2021

--

We’re very fortunate these days when reading code, especially with languages like C#; it’s actually fairly readable to humans. When it comes to writing code, however, it can be tricky to stare at that blank class wondering where to begin.

Enter pseudo code.

Pseudo code is a way of noting in plain language what you want to achieve with your code. It’s a bridge between design and implementation when it comes to software development. You can plan what you want to happen in as an outline for creating the actual code.

Let’s look at an example with player movement.

Some pseudo code

From our design, we know we want to use the WASD keys for movement. We break that down into individual keys. We write what we want those keys to achieve. Simple and understandable.

Filling in the code

Instantly we can see that ‘if’ we press a key something happens, so we know we will be working with ‘if’ statements. We can fill that in and, if necessary expand the pseudo code inside.

We now can figure out how to actually perform the action. We translate the position up whenever W is pressed. We can now repeat this for each of the keys to get the final result we wanted to achieve.

So by using pseudo code to plan out our controls and working logically through it we can translate our plan to functioning code.

Pro tip: do not copy this code directly, it will make for a horrible movement system!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Ian Plumpton
Ian Plumpton

Written by Ian Plumpton

Software developer in the field of Unity and C#. Passionate about creating and always driven to develop.

No responses yet

Write a response