The Universe of Programming
Writing Algorithms
We say that
a program quantifies an algorithm. How does a robot buy bread? It
blindly follows a series of actions called
instructions, so the
robot needs to be taught to understand the
algorithm.
Writing algorithms directly in a programming language (immediately obtaining the program) is advantageous because we can check if the algorithm is correct by running the code (paper can tolerate any mistake, but the computer will not). However, since we must always consider the constraints of the language while writing, we might make errors.
Regardless of the writing format, it is essential that
an algorithm is correctly thought out, and that is not easy!
It seems clear, doesn't it? In reality, it's not so simple.
What happens if the store is closed?
The robot gets stuck - it wasn't programmed for such an unplanned event. A human can make a decision (for example, go to another store), but the robot cannot make decisions unless it has been taught. This is a situation that the algorithm did not account for...
A properly designed algorithm must foresee all possible situations!
Remember: it is not difficult to learn a programming language, but it is much harder to learn to develop correct algorithms!
Learn about algorithm properties in the next section...