Pseudocode: Framework to Real Code

Nicholas Lim
2 min readMar 30, 2021

--

I’ll never forget my first programming class. The instructor asked us to tell him how to make a sandwich with ingredients in front of him. Naturally the instructions we gave packed a lot of assumptions about how sandwich making goes, such as “spread peanut butter”, to which he would ask back “How? Where? How much?”. Suffice to say it took a while to get to a finished sandwich and a messy tabletop.

Referring to this snippet of code from the earlier post on moving the cube, the comments in green are the pseudocode I’d write before any actual code. It’s useful in so many ways.

  • Lay out what I want to accomplish step by step
  • Prompts me to think of what programming tools or syntax I may need to look up (for example what a Vector3 is)
  • Perhaps show that code to another developer in order to get some feedback
  • Puts pen to paper (so to speak) in order to get the ball rolling
  • Identify potential problems early before I’ve spent too much time coding

After I’ve written out the code proper, I can decide to remove the pseudocode to tidy up the script.

There’s really no reason not to use pseudocode as a stepping stone in any programming task.

--

--

No responses yet