Why you need to be writing Pseudo Code

Pseudo Code — What is it?

Pseudo code is a tool for planning out your coding objectives. Think of it as an outline of what you plan to accomplish in code without all the formality of syntax.

How to write pseudo code?

To write pseudo code, enter single-line or block comments in your script.

  • Single-line comments are preceded by //
  • Multi-line comments are encased in /* … */, replacing “…” with your comments
How to write comments in your script

When writing pseudo code, keep the following steps in mind:

  1. Determine what you are trying to do
  2. Outline step-by-step how to make it happen in comments
  3. Follow your pseudo code to fill in your script
  4. Test your code and verify the results match your expectations
  5. Remove your pseudo code

If you were trying to set up player movement in a top-down 2D game, you might write the following pseudo code:

Sample pseudo code

Why use pseudo code?

Ever try to write an essay without some kind of plan? How about an essay in a foreign language? Well, that’s kind of what programming is — translating tasks in a specific step by step fashion that the computer can understand.

First you have to figure out the logical steps to accomplish the task (via pseudo code), then write them in command the computer can interpret. If you free-write your code, it’s easy to lose focus on the task at hand.

When it comes time to test your code, imagine if the results aren’t what you expected. First you’ll have to review each line of code to first determine what you were trying to accomplish, then determine why it’s not working as expected. If you use pseudo code, you can review the logic in the pseudo code and compare the code you entered to your pseudo code to determine if it is correct.

In the end, it comes down to two questions:

Would you rather start programming with this:

Empty function without pseudo code

Or this?

Empty function without pseudo code

And would you rather troubleshoot this:

Sample code without pseudo code

Or this?

Sample code with pseudo code




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

Recommended from Medium

AWS Serverless or Lambda, S3 uses .

Gocrypt a library for encrypting/decrypting with a tag field

Go Microservice with Clean Architecture: Application Container

Let’s GIT this Party Started

The 12 Factor App

GSoC 2020: Beginning of a New Adventure

Trias Weekly Report (Jun 15, 2020 — Jun 21, 2020)

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
Erin Brown

Erin Brown

More from Medium

5 Reasons to Choose Xamarin for Cross-platform Development

The differences between static and dynamic libraries

Stryker.NETWhat is Mutation testing?

Drag Race Flatiron: The Start of my Software Engineering Race

RuPaul’s Drag Race show opening