Reader-supported: when you buy through links on our site, we may earn an affiliate commission. Learn more

Cover of Code
Buy on AmazonBuy on Bookshop.orgListen on Audible

We earn a commission if you buy through these links. Learn more

Code

by Charles Petzold, Charles Petzold

Charles Petzold's Code builds a working picture of computers from everyday ideas like Morse code and light switches, so you finish understanding why simple on-off parts can calculate and remember.

What It's About

Code: The Hidden Language of Computer Hardware and Software is Charles Petzold's attempt to explain how a computer actually works, starting from almost nothing. He begins with ideas familiar from daily life, such as Morse code, flashlights, and light switches, and builds upward one step at a time. The promise is that by the end you understand, at least in outline, why a machine made of simple on-off parts can do arithmetic, store information, and run programs.

The approach is patient and constructive. Each concept is introduced and then used to make the next one possible, so the book reads as a chain of small discoveries rather than a survey of facts. Circuit diagrams and logic tables appear often, and Petzold encourages you to follow the reasoning instead of memorizing terms. The tone is warm and unhurried, with occasional historical asides. Reading it feels less like consulting a reference and more like being walked through a workshop by someone who enjoys the mechanics.

Expect to do some work. No advanced mathematics is required, but following the logic takes focus, and the reward comes when you pause to trace a circuit yourself. Readers hoping for a fast tour of modern computing or hands-on programming will find the pace deliberate. Think of it as a foundation rather than a finished picture of today's machines.

Read this if you…

  • are curious how computers actually work at the lowest level
  • want a patient foundation before studying programming or computer architecture
  • enjoy watching a big idea grow step by step from familiar objects

Skip it if you…

  • want a practical guide to writing code in a current programming language
  • need an up-to-date survey of modern processors, graphics chips, or cloud systems

Key Ideas

  1. 1

    Switches are enough to build a computer

    The book starts with the claim that a machine needs only parts that are either on or off. Electrical switches and relays can be wired so that one switch controls another. Once you see that a few such connections can make a decision, the rest of the machine stops looking like magic and starts looking like a sequence of ordinary, understandable steps.

  2. 2

    Binary turns any information into patterns

    Petzold shows how sequences of two states can stand for numbers, letters, and eventually anything else. The idea is less about base-two arithmetic than about the freedom to represent meaning with patterns of signals. Seeing that a letter and a number can be the same kind of thing in hardware is one of the book's most useful shifts in perspective.

  3. 3

    Logic gates make decisions out of circuits

    Simple circuits called gates combine inputs according to rules such as and, or, and not. Chained together, they can compare values and choose between alternatives. The book treats these gates as the basic vocabulary of hardware, and it spends real effort making their behavior feel intuitive before moving on to anything larger.

  4. 4

    Arithmetic is built from simple logic

    Addition, which seems like a basic operation, turns out to be a construction of gates wired together to handle carries. Once you follow how a circuit adds two numbers, multiplication and other operations seem less mysterious. This section demonstrates that the computer's arithmetic is not a special faculty but a stack of plain logical steps.

  5. 5

    Memory and instructions make machines programmable

    A calculator performs fixed operations, but a computer can hold both data and a list of instructions to follow. Petzold explains how feedback circuits can remember a state, and how a processor can fetch and execute steps in sequence. This is where the book connects hardware to software, showing why the same machine can run very different programs.

Limitations

Some readers find the early chapters on telegraphs and switches slow, especially if they already know the basics. The book focuses on the conceptual design of simple machines, so it does not cover modern processor design, memory hierarchies, or the software engineering practices used today. Its hardware examples are illustrative rather than current, and it is not a substitute for a course or hands-on experiments if you want to build something yourself.

Questions Readers Ask

Do I need a math or engineering background to read Code?
No. Petzold assumes only curiosity and willingness to follow an argument closely. Some concepts, like binary and logic, take a little patience to absorb, but the book introduces them slowly and uses concrete examples. Most general adult readers can follow it, though the reward depends on working through the circuit explanations rather than skimming them.
Is Code still relevant for understanding computers today?
Yes, for the foundations. Gates, binary representation, and the way a processor executes instructions remain the same at the core, even though modern chips are vastly more complex. The book will not explain current hardware in detail, but it gives you the mental model needed to understand more advanced material elsewhere.
Published
1999
ISBN
9780735605053
Difficulty
beginner
Category
Tech

Book details and cover from Google Books.

Ready to read Code?

Get your copy on Amazon, or listen to it on Audible. We earn a commission if you buy through these links.

Explore More