If you are new to computer programming, or if you are self-taught, you may be confused by some commonly used terms. Most people are clear on what a programming language is, but terms like "algorithm" and "pseudocode" are often tossed around without any clear understanding of their purpose. Algorithms, pseudocode and programming languages are all tools used by programmers at different stages of project development. If you understand their proper usage, you can develop programs faster, and those programs will be easier to maintain.
Video of the Day
An algorithm is simply a series of steps you follow when solving a problem. You list the steps in the order they should be performed. If you give a friend instructions on how to get to your house -- beginning at his initial location and ending at your intended location -- you could call that an algorithm for getting to your house. Recipes for baking a cake or instructions for building a table are also algorithms. However, computer programmers use the term specifically to describe the steps a properly designed computer program will follow to perform its intended purpose.
Of course, computers do not understand instructions written in human languages. The algorithm must be "explained" to them in a language they understand, and that language is binary code -- a series of zeroes and 1s that is difficult for humans to read and write without making a lot of mistakes. Programming languages were designed to make this process easier. They use special keywords and syntax -- the equivalent of vocabulary and grammar in a human language. The programming language then converts these keywords and syntax into binary code which the computer executes to perform the algorithm.
When they begin designing a program, the programmers often do not know in which programming language the program will ultimately be written. Even if they do, they may find that the programming language is not be a natural way for them to think clearly about the logic of the algorithm steps. To make this process easier, the programmers use an intermediate form of code called "pseudocode." Pseudocode sounds like a simplified human language, but it is not based on any specific programming language. Rather, it uses syntax which is common to many programming languages. A good example is decision-making syntax like if-then structures; another is looping syntax like for-next structures.
Advantages of Each
Each type of "language" gives the programmers an advantage at the development stage where it is used. Algorithms can be written in normal human language, allowing experts who are not programmers to provide input into the program's development phase. Pseudocode allows programmers who specialize in different programming languages to pool their knowledge and create the most efficient code, resulting in fast, compact programs. And the programming languages themselves provide flexibility, as some languages are better suited for certain jobs. By using all three tools, better computer programs can be developed more quickly and more economically.