Learn Computing Through Analogy
Concept · Why all programs are just arithmetic

Why All Programs Are Just Arithmetic

Web browsers, games, AI models, operating systems – they look completely different. But deep inside, every program the computer runs is built from the same tiny building blocks: arithmetic and logic on binary numbers.

1. What the CPU is really doing

At the lowest level, the computer only understands binary: 0s and 1s. Inside the CPU, the Arithmetic Logic Unit (ALU) keeps repeating a small set of operations:

Even a friendly high-level instruction like i = i + 1 becomes “add two binary numbers” inside the ALU. A loop condition like while (i <= 5) reduces to “subtract 5 from i and check whether the result is negative, zero, or positive”.

Under the hood: Every loop is just: compare → do some arithmetic → jump back or exit.

2. From simple rules to complex behaviour

When you write code in Python, C, or Java, you think in terms of:

These are higher-level abstractions for humans. When the program runs, they all compile down to the same pattern of machine instructions: add, subtract, compare, move bits, repeat.

A music player, a web browser, or even a neural network library is still just carefully organized arithmetic: binary operations executed billions of times per second.

Key idea: Programs only look complex at the surface. At the machine level, they are layers of abstraction built on top of basic arithmetic and logic.

3. Evolution analogy: from bacteria to mammals

Biological evolution follows a similar pattern. The earliest bacteria invented a few powerful tools:

Modern mammals, including humans, still run entirely on these same tools. ATP powers your muscles and thoughts, DNA stores your genome, and membrane channels make neurons and hormones work. All the “complex” systems of the body are built on top of these ancient bacterial inventions.

ATP ↔ Addition ATP is the universal energy currency in cells, just like addition is the universal operation underpinning almost all computations.
DNA ↔ Binary code DNA stores life’s instructions in four bases; machines store program instructions in 0s and 1s.
Cell membranes ↔ I/O & memory Membranes control what enters and leaves the cell, like memory and I/O control data flow in a computer.

4. Programming libraries as evolution toolkits

In programming, libraries play the same role that bacterial toolkits play in biology. A library is a collection of pre-built, well-tested tools that you can reuse instead of writing everything from scratch:

When you call a function like np.dot(A, B) in NumPy, you are relying on a highly optimized “math toolkit” built on top of basic arithmetic. You don’t manually implement every multiplication and addition – you reuse the library.

Evolution does the same thing: it doesn’t reinvent ATP, DNA, or mitochondria for each new species. It reuses and extends the same modules in more and more complex organisms.

Analogy in one line:
Bacteria : mammals :: arithmetic : complex software.
Bacterial toolkits : organs & systems :: programming libraries : modern applications.