Journal 06 — Why Pseudocode?

I’m assuming at some point in your day you have some ideas pop up for a great app or a game.

Where should you start?

What does the code ultimately need to look like?

Should you just dive right in?

Consider gathering your thoughts in pseudocode, which is basically a series of statements in a particular pattern/flow that describe what you want to happen. From there you can start to piece together the functionality by researching the required code to achieve your goals.

There is no “right” way to prepare pseudocode. You can consider terms such as the following to help identify certain logic that should be required: If-Then, Input, Output, While (true) Do this, Repeat-Until (something).

Here’s a brief example where we are trying to calculate the area of a circle from the radius that is adjustable. We prepare some brief statements on what we are trying to achieve and the area of a circle calculation from geometry.

Create a calculation for the area of a circle
C# create variables and equation that can be updated in real time
Results in Unity to see functionality

Here’s another brief example on the cost of something with a tip included. Similar to the above example, we provide a description of what variables we need, along with the calculation, and we also include a specific output format we are looking for.

Pseudocode to describe a calculation of a bill plus tip
C# variables for calculating tip
C# calculation for tip and total cost
Unity example outputs from tip and total cost calculation

While researching the C# calculation and how to develop a user-friendly output, I had to use specific formatting for the currency values (which is where the .ToString(“C2”) comes from), which are described here. You could include even greater functionality in the program for different regions by adding System.Globalization to the Namespace to add functionality for different world currencies.

Thank you for stopping by!

--

--

--

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

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

Recommended from Medium

Mechanical Sympathy in Go

{UPDATE} USA for Kids - Games, History & U.S. Geography Hack Free Resources Generator

Your first Rails Web App — Know your Stack

Measuring Software Quality — it isn’t about metrics

Thoughts on Visual Programming with Scratch

This Week In TurtleCoin (Feb 24 2018)

Introducing Frigate: A documentation generation tool for Kubernetes

Python calculator

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
Chris Nielsen

Chris Nielsen

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

More from Medium

Journal 143 — Unity Project Development, 2.5D Shooter

Basic Variables: Unity and C#

Making a Hack’n’slash #1: Moving and following our hero

What is a Control Track in Timeline