I made this widget at MyFlashFetish.com.

Saturday, April 9, 2011

PSEUDOCODE

What is pseudocode?
Pseudocode consists of short, English phrases used to explain specific tasks within a program's algorithm. Pseudocode should not include keywords in any specific computer languages. It should be written as a list of consecutive phrases. You should not use flowcharting symbols but you can draw arrows to show looping processes. Indentation can be used to show the logic in pseudocode as well. For example, a first-year, 9th grade Visual Basic programmer should be able to read and understand the pseudocode written by a 12th grade AP Data Structures student. In fact, the VB programmer could take the other student's pseudocode and generate a VB program based on that pseudocode.

Why is pseudocode necessary?
The programming process is a complicated one. You must first understand the program specifications, of course, Then you need to organize your thoughts and create the program. This is a difficult task when the program is not trivial (i.e. easy). You must break the main tasks that must be accomplished into smaller ones in order to be able to eventually write fully developed code. Writing pseudocode WILL save you time later during the construction & testing phase of a program's development.

How do we write pseudocode?
First you may want to make a list of the main tasks that must be accomplished on a piece of scratch paper. Then, focus on each of those tasks. Generally, you should try to break each main task down into very small tasks that can each be explained with a short phrase. There may eventually be a one-to-one correlation between the lines of pseudocode and the lines of the code that you write after you have finished pseudocoding.

It is not necessary in pseudocode to mention the need to declare variables. It is wise however to show the initialization of variables. You can use variable names in pseudocode but it is not necessary to be that specific. The word "Display" is used in some of the examples. This is usually general enough but if the task of printing to a printer, for example, is algorithmically different from printing to the screen, you may make mention of this in the pseudocode. You may show functions and procedures within pseudocode but this is not always necessary either. Overall, remember that the purpose of pseudocode is to help the programmer efficiently write code. 

Therefore, you must honestly attempt to add enough detail and analysis to the pseudocode. In the professional programming world, workers who write pseudocode are often not the same people that write the actual code for a program. In fact, sometimes the person who writes the pseudocode does not know beforehand what programming language will be used to eventually write the program.

0 comments:

Post a Comment