What Is a Computer?

Computers aren't black boxes: they’re predictable machines built on simple rules. Here’s how it all works.
A computer is a programmable device that processes, stores and retrieves data according to a set of instructions.
Diagram in how a computer works

A computer:

Computers are versatile because they can perform logical operations, and both data/programs can be stored and reused.

They are deterministic: given the same input, they always produce the same output. This is why they are accurate and highly reliable.

Computers follow instructions exaclty as given. Errors only come from incorrect programs (human error) from hardware failures (very rare).

They are also extremely fast: modern computers can perfom millions or billions of operations per second!

Automation is another key property: once programmed, computers execute instructions automaticaly without human intervention.

The Foundation

At the foundation of all computation are logic gates.

Logic gates are what enable computers to make decisions. They are based on Boolean algebra.

A logic gate can be any device that can reliably produce 2 distinguishable states and enforce conditional behaviour.

To perform logic, a device must have:

1 - Two stable states

Examples:

This is the binary requirement. A logic gate must reliably produce 2 distinct states, and nothing in between.

2 - Repeatability

Same input → Same output

The output must be determined only by the input state. A gate cannot produce different outputs for the same set of inputs.

If a device satisfies these two rules, it can perfom logic. A logic gate can be built from almost any material, as long as it obeys those rules.

Examples

Why Transistors?

We use transistors because they are the fastest, smallest, cheapest, and most reliable way to switch between states.

Early computers used relays and vacuum tubes:

Transistors solved these problems:

This is why moden computers use transistors

The fundamental logic gates

Now that we know why transistors are used, we can explore the 3 most basic logic gates

All computers are built from logic gates.

In essence, a computer processor is just millions (or billions) of transistors wired together according to laws of logic, controlling the flow of electricity to produce results. All inside a tiny package called microchip.

The combination of milions of those logic gates allows computers to produce results at extraordinary speed.

Why these three gates?

NOT, AND, and OR are the simplest set of gates that can construct any possible logical function, no matter how complex.

There are other common logic gates: NAND, NOR, XOR, and XNOR. But all of them can be built using only NOT, AND, and OR gates. These 3 are the fundamental building blocks of Boolean logic.

These gates also align with how humans naturaly think and reason. Logic gates are digital versions of the logic we already use in everyday decision-making.

In the next article, we'll break down the NOT, AND, and OR gates.