Pseudocode in Unity

How to learn and write code faster

When people see a part of programming script written it looks like gibberish. Nothing a sane human will understand. If you are trying to learn programming and instantly type out the ‘gibberish’ computer language you making it yourself a lot harder then necessary. You already have years of experience think logically and are able to talk and write. It makes more sense to continue building on what you already know. Let’s break it down in a few steps.

What do you want to do?

Start with asking this question and write it down.
Example: I want to create a script that checks the temperature and if it’s greater then 16 degrees it says “Ice cream weather!”
If we break it down further:
Get temperature
If temperature is greater then 16
then print out “Ice cream weather!”

This is the saying the same thing as when you write code, but in a human readable language. Although it’s readable it’s already very close to computer code.

Translate to code

The written text already contains all logic we want to implement. This allows us to focus purely on getting the syntax (computer grammar) correct. The result could look something like this:

This was a short example, but for more complex problems this method helps even more to solve it faster. Pseudocoding separates the thinking about the logic and translation to machine readable language. Unless you are a machine better use the tools you are familiar with, human language and thinking. After that translate it to the machine language.

Tips to learn

Write your code so you can read it yourself. A good way to check it is you can read it out loud (or in your head).
When you get more experience you may choose to use all kinds of techniques to write code faster at the cost of readability. Still generally it’s better to make it readable , since you or someone else may need to read your code later to fix, improve or adjust it.

Always type it out instead of copy pasting. Actively programming and typing out means your brain is more involved and you will retain the knowledge better.

Aspiring developer that’s self-learning Unity & C# to transition to a career with Unity. I got a passion for creating interactive experiences.