Thinking with Pseudocode

Much of our thought is subconscious; we're not precisely aware of the form it takes or how it works.

We also think a lot in words, spoken or silently rehearsed. Words and sentences are long sequential strings of "first this happened, then next, and ultimately that." We occasionally punctuate these linear narratives with, "in the meantime, while and whereas" to give an opportunity for things to slip in sideways, acknowledging that parallel factors are also important interventions into our sequential streams of consciousness.

Why is there such a disjunct between our natural world which is largely parallel and our natural languages which are largely serial? There is evidence that our unconscious thought is largely parallel as well, so why did we evolve a serial mode of expression? Perhaops there's not the bandwidth in verbal communcation to support parallelism. Perhaps when the communication channel is narrow, serial communications are the most efficient.

Regardless of the cause, we need to be able to translate our mental models of the world into computational models. To do this we take a circuitous route eventually passing from mental models to discursive linguistic models to computational models. This requires a lot of metal gear-shifting, and it is often useful to stop a little short of creating a model in computer language. Think of pseudocode as that half-way resting place between thinking in customary natural language and writing valid C++ code. Once you have a feeling for C++ vocabulary and syntax you should be able to sketch a program that is half-way there, not quite English not quite C++.

Pseudocode is any notational Pidgin or Creole that captures some aspects of the flow and logic of the program you are designing. It has its value in providing a transition language situated between your metaphorical ideas and the strict programming language the machine can understand. It outlines the general flow of what you want to do and how you want to do it, but it won't run on a computer.

You may wish to flesh out your ideas right in the .cpp source code file. Block out the framework of your program by in pseudocode by preceeding it with double slashes "//" which makes them invisible to the critical eye of the compiler. Once you have built a general structure in pseudocode, you can begin to replace it with blocks of valid C++ code and functions.