OOPortal OOPortal

Computer Algorithms  «Prev  Next»
Lesson 2Computer programs
ObjectiveDefine the elements of computer programs.

Define Computer Programs

Today computers are almost everywhere.
They are in
  1. our cars,
  2. our homes,
  3. our workplaces, and
  4. embedded into our cerebral cortexes.


When we write a computer program, we are generally implementing a method that has been devised previously to solve some problem. This method is often independent of the particular programming language being used, it is likely to be equally appropriate for many computers and many programming languages. It is the method, rather than the computer program itself, that specifies the steps that we can take to solve the problem. The term algorithm is used in computer science to describe a finite, deterministic, and effective problem-solving method suitable for implementation as a computer program. Algorithms are the stuff of computer science: they are central objects of study in the field.
We can define an algorithm by describing a procedure for solving a problem in a natural language, or by writing a computer program that implements the procedure, as shown at right for Euclid's algorithm for finding the greatest common divisor of two numbers, a variant of which was devised over 2,300 years ago.

Computers fly aircraft, make perfect toast, and balance our checkbooks. There are very few parts of our lives where computers are not in some way useful.
Some computers fill an entire room and perform highly complex tasks, such as modeling the Earth's atmosphere,
while others fit in your pocket and to calculate compound interest.
Despite the tremendous range in capability and responsibilities of modern computers, they all have one thing in common: they need to be told how to do their job.
Computers are told how to perform a task or solve a problem through a set of instructions. The set of instructions used in a computer to bring about a specific result is called a computer program; the process of creating a computer program is called computer programming. Computer programs are often referred to as application programs or simply applications.
In many respects, a computer program is very much like a recipe. Just as a recipe tells the cook what ingredients and tools to use and what steps to carry out to prepare a dish, a computer program tells the computer what resources to use and what sequence of instructions to execute in order to achieve the objectives of the program.
Now that you have a general understanding of what a computer program is and what it does, continue on to the next lesson to learn the basic components of a computer.