What is a program?
A program is an organized set of instructions that tells a computer what to do.
A computer may be able to add, compare, store, copy and communicate. A program arranges these basic abilities into a particular activity: calculating a bill, displaying a page, guiding a vehicle or generating a sentence.
The computer supplies the possible operations. The program selects and orders them.
In short, a program turns a general machine into a particular tool.
Is a program the same as an algorithm?
No.
An algorithm is a definite method for performing a task or solving a problem. A program is an expression of one or more algorithms in a form that a computer can execute.
The method for sorting names alphabetically is an algorithm. Its instructions written in Python, JavaScript or machine code form a program.
The same algorithm can be expressed through different programs. A single program can also contain many algorithms.
What is an instruction?
An instruction asks the computer to perform one available operation.
It may tell the computer to:
- Load or store some data
- Add or compare values
- Choose between two paths
- Repeat a group of instructions
- Receive input or produce output
Each instruction is small. Useful behaviour appears when many such instructions cooperate.
A recipe provides a simple analogy. “Heat the pan” is one instruction. It does little alone, but becomes meaningful as part of an ordered procedure.
Why does order matter?
Later instructions often depend upon earlier results.
If a program tries to display a total before calculating it, the correct ingredients may all be present while the result is still wrong.
Order also matters when the world changes. A navigation program must learn the present location before deciding which turn comes next.
A program is therefore not merely a bag of commands. It is a structure of dependencies through time.
How does a program make choices?
Programs use conditions.
A thermostat might follow a rule such as:
if the room is colder than the chosen temperature:
turn the heater on
else:
turn the heater offThe condition connects information with action.
More complex programs may examine many conditions, estimate uncertainty or compare several possible outcomes. But the basic idea remains: different information can lead the computation along different paths.
Why do programs repeat steps?
Many tasks contain the same operation more than once.
A program can examine every name in a list, every pixel in an image or every measurement from a sensor by repeating a set of instructions.
This repetition is called a loop.
Without loops, a programmer would need to write nearly identical instructions again and again. A loop compresses the repeated pattern into a rule: continue until the work is complete or a condition changes.
What are data and state?
Data is information represented in a form the program can process.
State is the information that describes the program's present situation.
In a music player, the audio file is data. The current track, volume and playback position are part of the state.
State gives the past a way to affect the future. When a program remembers that you have already signed in, an earlier event changes what it does now.
What is source code?
Source code is a program written in a language intended to be read and changed by people.
Programming languages provide words, symbols and rules for expressing instructions precisely. They let a programmer name information, divide work into parts and describe choices and repetition.
A computer does not usually execute high-level source code directly. Another program translates or interprets it into operations the machine can perform.
This creates layers of meaning: human ideas become source code, source code becomes lower-level instructions, and those instructions become physical changes in hardware.
What is a bug?
A bug is a defect that makes a program behave differently from what was intended.
The computer may execute every instruction correctly and still produce the wrong result because the instructions themselves are wrong.
A program that calculates a discount before checking whether the customer qualifies is not disobeyed by the machine. It faithfully carries out a mistaken procedure.
This is why testing matters. A program should be tried with ordinary cases, boundary cases and unexpected input. Testing cannot prove that a large program has no defects, but it can expose failures before they cause harm.
Can a program change itself?
A program can change stored data, and that data may influence its later behaviour.
A learning system goes further: experience changes its internal model, which changes how future inputs are handled.
This is sometimes described loosely as a program rewriting itself. Usually, however, the learning rules remain part of the program while adjustable values within the model change.
The distinction matters. A system can acquire new behaviour without becoming free from the rules that govern how it learns.
Is a program intelligent?
Not by itself.
A short fixed program may follow a clever rule without understanding anything. A larger program may perceive patterns, learn from examples, draw inferences and make decisions.
Whether that behaviour counts as intelligence depends upon its flexibility, understanding and success across situations—not merely upon the fact that code is running.
A program is a means of organizing computation. Intelligence is one possible result.
So what is a program, finally?
A program is information that organizes the operations of a computer.
It receives data, preserves state, makes choices, repeats work and produces results. Its instructions may express algorithms, use models and change their behaviour through learning.
Hardware provides the physical ability to compute. A program gives that ability a temporary purpose.
That is why one machine can become many different tools without being rebuilt.


