Code: The Hidden Language Review: How Computers Really Work

Code: The Hidden Language of Computer Hardware and Software by Charles Petzold

Author: Charles Petzold · Published: 1999 · Genre: Computer Science, Programming

The biggest strength of Code is its method: it starts with two children signaling to each other with flashlights and, one small step at a time, builds up to a working computer, so nothing is left as magic. Its biggest weakness is uneven pacing. The middle chapters of circuit diagrams demand patience, and the first edition’s closing chapters on 1990s software feel rushed and dated. It is the best book for programmers and curious non-programmers who want to know what actually happens inside the machine.

Macro photo of a laptop circuit board with chips, capacitors and solder traces
Macro photo of a laptop circuit board with chips, capacitors and solder traces. Photo by Alexandre Debiève on Unsplash.

The core ideas

Petzold, best known for his books on Windows programming, assumes no technical background at all.

  • Everything is a code. Morse code and Braille show that information can be represented with simple two-state signals, dots and dashes or raised and flat dots. Binary numbers are just another code.
  • Relays become logic. An electrical relay, invented for the telegraph, is a switch controlled by electricity. Wire relays in series and you get an AND gate; wire them in parallel and you get OR. Boolean algebra, George Boole’s mathematics of logic, turns out to describe these circuits exactly.
  • Arithmetic from gates. Combine gates into a half adder, then a full adder, then a circuit that adds binary numbers of any length. Subtraction follows by adding complements.
  • Memory from feedback. Feed a circuit’s output back into its input and you get a flip-flop that remembers one bit. Stack enough of them, add addresses, and you have memory.
  • From circuits to a computer. An oscillator supplies the clock, and adders, memory and control logic combine into a machine that fetches and executes instructions. The book then covers real microprocessors, ASCII text, operating systems, floating-point numbers and programming languages.

What’s great

  • No gaps. Each chapter depends only on the ones before it. By the time a working computer appears, you have seen every piece built from switches, which no other popular book achieves so completely.
  • History woven in. The story of each idea, from Morse and Braille to Boole, the telegraph and early computers, gives the technical material a human thread and explains why things are the way they are.
  • Real moments of understanding. Watching a flip-flop remember a bit, or an adder produce a sum, is the kind of insight most programmers never get, even after years of writing code.
  • A strong second edition. The 2022 edition explores the construction of the central processing unit more deeply, gate by gate, and comes with a companion website, CodeHiddenLanguage.com, whose animated diagrams make the circuits much easier to follow.

What’s weak

The pacing is the main problem. Chapters full of gate diagrams are hard to read casually, and many readers end up skimming exactly the parts that matter most.

The first edition’s final chapters compress operating systems, languages and graphical interfaces into a quick tour, written from a late-1990s point of view that has aged. Both editions stop well short of modern processor design, so readers wanting to know how today’s chips get their speed will need another book.

It also won’t teach you to program. It explains what programs run on, not how to write them.

Who should read it

Self-taught programmers, computer science students before a computer architecture course, and non-technical readers who want to understand the machines they use. Get the 2022 second edition. If you want to build rather than read, follow it with a hands-on course such as Nand to Tetris.

Rating: 4.5/5

Image credits — In-article images: Photo by Alexandre Debiève on Unsplash.