PSEUDOCODE - also known as STRUCTURED ENGLISH
Note the spelling: it is not "psuedo"! Pseudocode is halfway
between normal language and programming language: it's a loose mixture
of the two that allows very rapid planning of ideas and methods without
getting bogged down in 100% accurate program coding (which is slow and
exact, and may hinder a flow of thought). It's like a shorthand for programmers.
When the pseudocode looks right, it is translated into proper programming
code.
When programming, the precise syntax of commands (how the commands are
constructed) can be enormously slow and difficult. When designing, you
sometimes want to quickly describe the function of a part of a program
without getting bogged down in the fiddly syntax. Pseudocode describes what the module needs to do in broad terms (the algorithm ).
e.g. an algorithm to sort a virtual deck of cards in Structured English
(or pseudocode).
sub shuffle
create an array of 52 integers - cards(52)
loop through the array, filling each array item - card(i) - with the
index (1 to 52)
loop through the array
for each loop, generate a random number between 1 and 52 (rnd)
swap the current index with that of array(rnd) - swap card(i),card(rnd)
end loop
end subprogram
As you can see, it's not quite readable English, nor is it working programming
code, but it's enough to be able to tell a programmer how to program a
particular subprogram independently of any programming language.
|