Code of the Day
BeginnerMental Models

What is a program?

A program is a precise description of a process — instructions, data, and state working together.

FundamentalsBeginner7 min read
By the end of this lesson you will be able to:
  • Explain what a program is in terms of instructions, data, and state
  • Describe how a program moves from "source you write" to "process that runs"
  • Recognise why precision and unambiguity are the whole game

Before you write a line of code — or ask an agent to write it for you — it pays to know exactly what you're making. A program is a precise, unambiguous description of a process: a recipe written carefully enough that a machine with no common sense can follow it and get the right result every time.

That last part is the catch. A machine has no judgement. It does not know what you meant. It does exactly what you said, at enormous speed, including your mistakes. Programming is the discipline of saying what you mean precisely enough that "exactly what you said" and "what you wanted" are the same thing.

Three ingredients

Almost every program, in any language, is built from three things:

  • Instructions — the steps to perform, in order. "Add these two numbers." "If the user is logged in, show the dashboard."
  • Data — the information the instructions work on. A number, a name, a list of orders, an image.
  • State — the data right now, which the instructions change over time. A shopping cart starts empty, gains items, then is emptied at checkout. The cart is state; adding an item is an instruction that changes it.

Hold onto that triad. When you're lost in a confusing piece of code, asking "what's the data, what's the state, and what instruction just changed it?" will almost always get you unstuck.

From source to running process

You write source code — text, meant for humans to read. But a CPU doesn't read text; it executes very simple numeric operations. Something has to bridge that gap:

  • A translates your whole program ahead of time into instructions the machine runs directly (languages like Rust, Go, C).
  • An reads and executes your program step by step as it runs (the classic model for Python).
  • Many modern languages blend the two (JavaScript engines compile hot code just in time while running).

The details differ, but the shape is the same: human-readable source becomes a running process — a live thing with its own memory and state, doing what your instructions describe.

Why precision is the whole game

Consider the instruction "remove the last item from the list." Obvious to a human. But what should happen if the list is empty? A person shrugs and does nothing. A machine will do whatever you specified — and if you didn't specify, it may crash, or silently corrupt your data. The bugs you'll spend your life chasing almost always live in the cases you didn't think to describe.

This is also why working with AI coding agents is a fundamentals skill, not a shortcut around them. An agent can generate plausible instructions astonishingly fast — but it's still on you to know what the process should actually do, including the awkward edge cases, and to verify that what was written matches what you meant.

A useful reframe: you are not "writing code." You are specifying a process precisely enough that something with no judgement can carry it out. Code is just the notation.

Check your understanding

Knowledge check

  1. 1.
    Which best describes what a program is?
  2. 2.
    Which of these are core ingredients of almost every program?
  3. 3.
    A machine will infer what you meant if your instructions are ambiguous.

Where to go next

Next we'll open the box a little: how a computer actually runs your code — the loop of fetching and executing instructions, and where data lives while it runs.

Finished reading? Mark it complete to track your progress.

On this page