Pages

Saturday 3 November 2012

Rules for Writing Pseudocode











The Pseudocode is very clear unlike flowcharts. It is more individualistic, hence use the following rules for writing Pseudocode.
* Write one statement per line.
* Capitalize initial keywords.
* Indent to show hierarchy.
* End multiline structure.
* Keep statements language independent.
Now, let us go through each of the rules seperately and briefly.

1. Write one statement per line :
After getting the formal design, such as lists of major tasks, subtasks and so on. Now converts those tasks lists into a formal design, that can be used as the basic for coding. Break each task into smallest level of subtasks or sub-sub tasks. then convert each of those detail elements into line in our pseudocode. Each pseudocode line will represent one "action".
2. Capitalize Initial Keywords :
The keywords in the pseudocode should be written in all capital letters, because they begin the statement and they are command words, that give special meaning to the operation. In the statement Total=m1+m2+m3, we do not put any word in all capitals because, we do not have a keyword. Primarily READ, WRITE, IF, WHILE, and UNTIL are the keywords that must be written in capital letters.
3. Indent to show hierarchy :
Indentation is the process of showing the "boundaries" of the structure. As in case of sequence structure, we would not have any indentation, because we do not have any questions of hierarchy. But in the loop or selection structure, we must indicate the statement which is fall in the loop or selection.
4. End Multiline Structure :
We have already seen that the indentation is used to indicate what statements are executed within the structure. Such structures must be ended and it provides the increased clarity.
5. Keep statements language independent :
This rule does not mean that we can write our pseudocode in English, French, Russian, Chinese or whatever languages we know. It refers to programming language. Some programming languages have special capabilities that are not available in other languages. So, we should design our program in such a way that it is free of those special requirements.

3 comments: