Unity/Programming Analysis

Why you need to be writing pseudocode

A quick analysis about the importance to write down pseudocode before programming

Have you ever tried to start programming a function or feature for your development project and then all of a sudden you find yourself stuck in a line or part of the process without remembering what were you going to do?

Well, if you had pseudocode before started programming I can assure that you wouldn’t be trying to remember what was the next step to code for the function.

Pseudocode is a description of the steps that an algorithm will cover. As it’s a syntax-free description, it’s a good practice to write pseudocode using comments in the code or in another easily reachable medium.

For example, if I needed a function to limit the space where a player in my space shooter game in Unity can move I’d need to write the next pseudocode:

This way, I can think in each individual condition, variable and possible result when the function is executed. Instead of looking into a flowchart I can easily read my pseudocode and get the idea that I need to remember.

Once I finish with the function I can erase the pseudocode or use it to leave comments about what the function does, so that every other developer that reviews the code can easily find out what’s the purpose of the function in the project.

This function teleports the player of the space shooter if it reaches the limits

The function works and now the player teleports to the other side if it reaches the limits of the space:

And that’s it, you should start writing pseudocode before programming in Unity or in any other program! :D. I’ll see you in the next post, where I’ll be showing how to instantiate and destroy gameobjects in Unity.

If you want to know more about me, feel free to connect with me on or visit my :D

--

--

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
Fernando Alcantara Santana

Fernando Alcantara Santana

93 Followers

A passionate computer technology engineer and Unity developer that is always looking to grow in every aspect of life :).