Code: The Book That Reveals What Your Computer Is Actually Doing
How Charles Petzold built a complete mental model of computing from flashlights and Morse code. A book review and analysis of the essential guide to understanding computers.
Code: The Book That Reveals What Your Computer Is Actually Doing
How Charles Petzold built a complete mental model of computing from flashlights and Morse code

In 1999, Charles Petzold published a book that should have been impossible. He promised to explain how computers work—really work, at the level of electrons and logic gates—to readers with no technical background. And he delivered.
"Code: The Hidden Language of Computer Hardware and Software" doesn't just explain computing concepts. It builds them, layer by layer, from everyday objects you already understand. By the end, you've mentally constructed a working computer. You know what's happening behind every pixel on your screen.
This is not a book about programming. It's a book about understanding.
The Flashlight That Explains Everything
Petzold begins not with computers, but with a flashlight. Battery. Wire. Bulb. Switch. From this simple circuit, he explains electricity, current, and the fundamental concept that will drive everything else: the circuit can be either on or off.
Binary. One or zero. True or false.
From the flashlight, he moves to the telegraph—a technology from 1844 that laid the conceptual groundwork for every digital system we use today. Samuel Morse's code wasn't just a communication protocol; it was humanity's first practical demonstration that information could be encoded as on-off signals and transmitted across distances.
The telegraph relay—a switch that uses an electromagnet to flip another switch—becomes the ancestor of every transistor in every chip ever made.
Building a Computer from First Principles

The genius of Code is its methodology. Each chapter adds exactly one layer of complexity. Nothing is assumed. Nothing is hand-waved. When you reach logic gates (AND, OR, NOT), you already understand why they work because you've built them mentally from relays and batteries.
The progression looks like this:
- Flashlights and circuits → Understanding electricity
- Morse code and Braille → Information encoding as binary
- Telegraph relays → Switches that control switches
- Logic gates → Combining switches for logical operations
- Adders and flip-flops → Arithmetic and memory
- Bytes and words → Organizing binary data
- Instruction sets → The language computers actually speak
- CPU architecture → How it all fits together
By Chapter 17, you've built a complete Von Neumann machine in your head: processor, memory, instruction set. The mystical "computer" becomes a deterministic machine you could theoretically wire together with telegraph relays and batteries.
Logic Gates: The Building Blocks

One of the book's most powerful sections explains how simple logic gates combine to create all computing functionality:
- AND gates output 1 only when both inputs are 1
- OR gates output 1 when either input is 1
- NOT gates flip the input
From these three primitives, Petzold shows how to build adders, memory cells, and eventually an entire processor. The insight that stays with you: any computation can be reduced to combinations of these simple operations.
The History You Didn't Know You Needed
Petzold weaves computing history throughout the technical explanations, and the result is illuminating. You learn that:
-
Boolean algebra was invented by George Boole in 1854 as pure mathematics. It had no practical application until Claude Shannon's 1937 master's thesis showed it could describe electrical switching circuits. Shannon's paper is arguably the birth certificate of digital computing.
-
Ada Lovelace, writing in 1843 about Charles Babbage's never-built Analytical Engine, described concepts that wouldn't be implemented for another century: loops, conditionals, and the key insight that a computing machine could manipulate any symbols—not just numbers.
-
The ENIAC, completed in 1945, used 17,468 vacuum tubes and weighed 30 tons. It performed calculations that would take a human mathematician years—but only because someone had to physically rewire it for each new problem.
The history isn't decoration. Understanding why things developed as they did helps you understand what they are. Binary isn't arbitrary—it's the simplest possible distinction (on/off) that can be reliably transmitted and detected.
Understanding Abstraction Layers

One of the book's most valuable contributions is explaining how modern computing works through layers of abstraction:
- Transistors → the physical switches
- Logic gates → combinations of transistors
- Registers and memory → gates organized to hold state
- CPU instructions → patterns that trigger gate operations
- Assembly language → human-readable instructions
- High-level languages → Python, JavaScript, etc.
- Applications → what users actually see
Each layer hides the complexity below. Understanding this stack transforms how you think about software. Nothing is magic—it's gates all the way down.
What the Book Covers
The journey spans 25 chapters (28 in the 2022 second edition):
Foundation (Chapters 1-5)
- Flashlights, batteries, circuits
- Morse code and encoding
- Braille and alternative codes
- The telegraph revolution
Logic and Gates (Chapters 6-11)
- Boolean algebra
- Relay-based logic
- AND, OR, NOT, NAND, NOR gates
- Number systems and binary
Building Blocks (Chapters 12-17)
- Adding machines from gates
- Flip-flops and memory
- Bytes and character encoding (ASCII, Unicode)
- RAM and addressing
The Computer (Chapters 18-24)
- Clock signals and timing
- The arithmetic logic unit
- Registers and buses
- CPU control signals
- Assembly language and machine code
The Modern World (Chapters 25-28)
- Operating systems
- Graphical interfaces
- Floating-point math
- The internet and web browsers
Why This Book Still Matters
Code was published in 1999 and updated in 2022, but its core teaching remains timeless. Transistors have gotten smaller, but they still work the same way relays do. Software has gotten more complex, but it still executes as sequences of binary instructions. The cloud runs on data centers, but each server is still a Von Neumann machine.
For modern readers, Code offers something increasingly rare: first-principles understanding.
In an age of abstraction—where most programmers never think about what's happening below their runtime—Petzold provides the complete picture. You won't need this knowledge to write Python scripts. But you'll understand what Python is, and why computers can execute it.
Scott Hanselman, Microsoft engineer and podcaster, wrote: "For me, Code was a revelation. It was the first book about programming that spoke to me... Code is a book that is as much about Systems Thinking and abstractions as it is about code and programming."
The Transformation

There's a moment, somewhere around Chapter 15, when the mental model clicks. You realize that a "computer" isn't magic—it's just millions of very simple switches connected in very clever patterns, flipping on and off billions of times per second according to rules that you now understand.
The pixel on your screen becomes explicable: a specific memory location holding a specific value that a specific piece of hardware interprets as a specific color. The "instruction" your processor executes becomes a pattern of bits that triggers a specific sequence of gate operations.
Nothing is hidden anymore. You see the code beneath the code.
That's what Petzold promised. That's what he delivers.
Who Should Read This Book
Absolutely read it if:
- You're a programmer who never learned how hardware works
- You're curious about computers but intimidated by technical books
- You want to understand computing at a fundamental level
- You're teaching yourself technology and want solid foundations
Consider skipping if:
- You have a CS degree with computer architecture coursework
- You're looking for practical programming skills
- You want coverage of modern topics (networking, AI, cloud)
Be prepared for:
- Detailed circuit diagrams requiring patience
- Math (primarily binary arithmetic)
- A commitment of 15-20 hours of focused reading
Getting Started
The book is available in two editions:
-
First Edition (1999/2000): The classic, available used and in libraries. 400 pages, 25 chapters.
-
Second Edition (2022): Expanded with 28 chapters, deeper CPU coverage, modern topics (touchscreens, JavaScript, the web), and an interactive companion website at CodeHiddenLanguage.com.
If you're starting fresh, the second edition is the better choice. If you have the first edition, it still holds up remarkably well—computing fundamentals haven't changed.
Either way, allocate time for it. This isn't a book to skim. Each chapter builds on the previous. Miss a concept, and later chapters won't make sense.
But if you give it the time it deserves, you'll emerge with something valuable: the ability to see through the abstractions, down to the electrons.
Code: The Hidden Language of Computer Hardware and Software by Charles Petzold is available from Microsoft Press, Amazon, and major booksellers. The companion website is at charlespetzold.com/code.
Written by
Global Builders Club
Global Builders Club
If you found this content valuable, consider donating with crypto.
Suggested Donation: $5-15
Donation Wallet:
0xEc8d88...6EBdF8Accepts:
Supported Chains:
Your support helps Global Builders Club continue creating valuable content and events for the community.


