Pseudocode

Pseudocode is a tool which outlines the structure of a program, to see all possible data that a computer needs to carry out a given task. It describes’s the computer’s step-by-step actions to use it as a map for writing the actual program, in whatever language it might be in. The actual pseudocode cannot actually be executed, as there is no standard formatting/syntax rules to follow. The benefit of it however is that it enables the programmer to concentrate on the algorithms without worrying about knowing all the syntactic details of a particular programming language. You can even write pseudocode without knowing the programming language that will you will use in the final implementation.

Even a top programmer, using any programming language, when faced with a blank text file may find it difficult to know where is the best place to start. After thinking too much about syntax, case sensitivity and whether you need ‘{}’ or ‘()’ brackets, just like any other writing styles, it may be difficult to know where to start. This is where pseudocode steps in.

So how do you write pseudocode? When starting, it’s best to move away from the computer and grab the ancient pen and paper that is probably gathering some dust at the bottom of a cupboard nearby. The aim is to write out instructions for the computer in simple English. I like to think of it as what you would physically say to a computer if it could write the programme for you. This is so that it is understandable to anyone, even if they don’t have any previous programming knowledge.

For example, the pseudocode for adding someone to an emailing list could be.
    ask user for email address

      if email address matches accepted pattern
      add them to email address

      else

      show error message on-screen

Pseudocode is not any specific language, therefore it does not have any formal rules to follow while writing it. The whole point of it is to show the structure of a system that is being designed. As it will be written in a writing style that is personal to the individual who is writing it out, different people may write it out in different ways.

References:

– Allardice, S. Writing Pseudocode from the Course Foundations of Programming: Fundamentals. Available From: http://www.lynda.com/Developer-Programming-Foundations-tutorials/Writing-pseudocode/83603/90472-4.html [Accessed On: 21 November 2014].

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s