Why you need to be writing pseudo code

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:

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.