Skip main navigation

What is the Definition of a Computer Program?

A program is a set of instructions that a computer can run. Programs are clear, ordered, and in a language that computers can follow.
A split image. On the left-hand side a child has successfully erected a tent following instructions from an adult. On the right, a frustrated robot has failed to erect the tent, and the instructions are on the floor.

Building on the simple working principles of a computer, namely input, processes and outputs, we will now look in more detail at how computers can be programmed and consider the similarities and differences that occur between giving instructions to a computer and giving instructions to a friend.

What is a Program?

A program is a set of instructions that a computer can run. Programs are clear, ordered, and in a language that computers can follow.

Giving Instructions in Order

Giving instructions to a computer shares some similarities with giving instructions to a friend, but there are some key differences. Imagine that you were instructing a friend to put up a tent.

You may start by giving your friend an instruction and waiting until they have completed the instruction before moving on to the next step. Similarly, when programming a computer you give a set of instructions, but unlike when instructing your friend, you wouldn’t be able to see how the computer had responded to each instruction before you gave it the next one. Instead, you would write the entire set of instructions, or programs, and then run them. When you instruct the computer to run the instructions, it will follow the instructions that it understands in the given order.

You might start by instructing your friend to take the tent out of its storage bag. It’s important that this happens before you try to get them to do anything with the contents of the bag. When programming, you have to make sure that you give the instructions in the correct order, as the computer will go through them in that order. Unlike your friend, the computer would not be able to realise that the “open the bag” instruction was missing if you left it out.

Instructions in the Right Format

In order for your friend to follow your instructions, they will need to be in a format that they understand. For example, your friend might not understand words read straight from a manual, such as ‘guy ropes’ or ‘A-frame’, and these words may need explaining. Whereas your friend may be able to infer what you mean – look at a diagram, hold up certain pieces of equipment for clarification, or ask questions – this is not possible for a computer. Computers only understand certain instructions or commands in the language that the user is programming them in, so instructions need to be written clearly and accurately. Not all computers understand the same things, so some will require the users to create programs using blocks and others will use text-based languages.

If you decided to write the instructions down for your friend, they would be able to see past any spelling and grammatical errors or ask for clarification if handwriting is illegible, but computers will not. It is important that you avoid typing errors when using text-based languages, as the computer will not be able to interpret the instruction and the program will stop.

Clear Instructions

Once the instructions to erect the tent have been followed, your friend will be able to look at the tent and evaluate if they have been successful. For example, if part of the tent is sagging, they may decide they need to adjust one of the ropes to fix the problem. Computers do not have the capacity to evaluate whether a program of instructions has been carried out correctly. They will follow the instructions regardless of whether they are successful in producing the output expected by the programmer or not. This once again shows the importance of designing and writing programs that are clear and concise.

Discussion

Why is it important for children to learn that computers only follow the instructions that they have been given?

This article is from the free online

Teaching Programming to 5- to 11-year-olds

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now