Software: instructions that do useful work
Hello, and welcome to your first lesson! The Stage 0 overview told you where we're going. Now we begin, with a sum you could do on paper.
In this lesson, you'll learn:
- what a program is, and what data is;
- how hardware and software work together;
- why a result that looks right still needs checking.
Why it matters: these few ideas are the base for everything else in the book, including checking what an AI writes for you.
A sum you can do on paper
Imagine a savings committee with three members. Each member must pay 1,000 rupees this month. That is the amount due.
The organiser keeps a record of what each member has actually paid so far. That is the amount received:
| Member | Received |
|---|---|
| Member A | 1,000 |
| Member B | 1,000 |
| Member C | 500 |
The organiser wants an app (a program on a phone or computer, made for one job) that shows the total received. On paper, that's easy: 1,000 + 1,000 + 500 = 2,500.
What a program needs: instructions and data
A computer can do the same sum, if something tells it how.
- A program is a set of instructions a computer can carry out.
- Data is the information a program works with. Here, the data is the three amounts.
For this job, the instruction is simple: add up the amounts received. Keep that sentence in mind. We'll come back to it.
How hardware and software work together
The phone itself, with its screen and the parts inside, is hardware: the physical parts of a computer. The app is software: the programs and the data they use, which tell the hardware what to do.
What goes in, what happens, what comes out
We can describe any program in three parts:
- Input: the data that goes in. Here, the three amounts.
- The steps that turn the input into a result.
- Output: the result that comes out. Here, the total on the screen: 2,500.
For our total, the steps are:
- Start with a total of 0.
- Add each member's amount.
- Show the total.
A list of steps like this, for solving a problem, is called an algorithm. A program writes steps like these in a form a computer can follow.
A number can look right and still be wrong
Now suppose the app shows 3,000. Nothing crashes, and the number looks sensible.
But 3,000 is not what the organiser asked for. It is the amount due: 3 members × 1,000. Somebody gave the program a different instruction: multiply the number of members by the amount due, instead of add up the amounts received.
The program did its sum correctly. It was just the wrong sum for the organiser's question.
This is why software engineering is more than writing code. It means understanding the problem, deciding exactly what the software should do, checking the result, and looking after the software as needs change. Writing the program is only one part of the job.
So before anyone builds this app, I would write down one thing clearly: "Show the total received, not the total due. If a member has paid only part, count only what they paid."
Check what you can now explain
Close the lesson and answer these in your own words:
- In the committee example, what is the hardware, the input and the output?
- What is the difference between the data and the instruction?
- The app shows 3,000. What would you ask before calling it correct?
Then look back and compare. You don't need the exact words, only the difference between the data, the steps and the result.
Next, we'll see how a computer actually holds numbers and instructions, in Binary and languages.