Sunday 1 February 2015

Defining Pseudocode


Defining Pseudocode

Pseudocode is a simple way of writing programming code in English. Pseudocode is not an actual programming language. It uses short phrases to write code for programs before you actually create it in a specific language. Once you know what the program is about and how it will function, then you can use pseudocode to create statements to achieve the required results for your program.

Understanding Pseudocode

Pseudocode makes creating programs easier. Programs can be complex and long. Preparation is the key. For years, flowcharts were used to map out programs before writing one line of code in a language. However, they were difficult to modify, and with the advancement of programming languages, it was difficult to display all parts of a program with a flowchart. It is challenging to find a mistake without understanding the complete flow of a program. That is where pseudocode becomes more appealing.
To use pseudocode, all you do is write what you want your program to say in English. Pseudocode allows you to translate your statements into any language because there are no special commands and it is not standardized. Writing our programs before you code can enable you to better organize and see where you may have left out needed parts in your programs. All you have to do is write it out in your own words in short statements. Let's look at some examples below.

Examples

Create a program to add 2 numbers together then display the result.
Pseudocode
Pseudocode for adding two numbers
Flowchart
Flowchart to add two numbers
Here are a few more simple examples of pseudocode:
Compute the Area of a rectangle
Pseudocode for computing the area of a rectangle
Compute the Perimeter of a rectangle
computing perimeter of a rectangle
Remember, writing basic pseudocode is not like writing an actual coding language. It cannot be compiled or run like a regular program. Pseudocode can be written how you want. But, some companies use specific pseudocode syntax to keep everyone in the company on the same page. Syntax is a set of rules on how to use and organize statements in a programming language. By adhering to specific syntax, everyone in the company can read and understand the flow of a program. This becomes cost effective. That is less time finding and correcting errors.

Basic Guidelines

If you would like to have a format to follow for using pseudocode to create your program, below are some basic guidelines:
Do not use language specific commands in your statements
Pseudocode should be universal. So, when creating the task list you would not include commands that are for any specific language like C++, Java, C#, or Perl. The point of pseudocode is to design a program that can be translated into any language.
Write only one task/statement per line
Make sure you put only one task on each line. Including too much information on one line can be confusing and increases the possibility of errors.
Capitalize Keywords
Capitalizing keywords like Read, Write, or Display helps to show when an action is occurring or when a specific command or process will be necessary when coding in your specific language.

No comments:

Post a Comment