Code: The Hidden Language of Computer Hardware and Software
Petzold starts with two kids signaling with flashlights and climbs, relay by relay and gate by gate, to a working processor. It changed how I think about the machines I use every day.
Writing code, debugging systems, building abstractions upon abstractions, and through all of it I carried an assumption, that somewhere beneath my feet lay incomprehensible complexity, circuits speaking in tongues I would never fully understand.
Then I read Code.
Charles Petzold wrote this book in 1999, from an idea that came to him back in the late 1980s while he was writing a column for PC Magazine. He wanted to answer a question the how-to books leave alone, which is how computers work, from the bottom, from nothing.

Beginning with Light
Petzold starts with a flashlight, not a CPU, not a programming language.
Two children want to talk after dark, so they work out a code, flashes of light in patterns. From that premise Petzold introduces Morse code, then Braille, and the pattern shows itself, codes everywhere, long before electricity, long before computers.
The genius of the book is that it refuses to start where the textbooks start. It asks what humans already understood about encoding information before we built machines to do it for us. Quite a lot, it turns out.
From Telegraph to Transistor

The electrical telegraph is the first machine Petzold examines in depth, wires carrying pulses, relays amplifying the signal across distances, the ancestor of modern computing with all the complexity stripped off.
A relay is a switch controlled by electricity, that is all, but relays can control other relays, and from that one fact come logic gates, AND, OR and NOT. From gates come circuits that add numbers, from those circuits memory, and from memory and arithmetic a processor.
The progression feels inevitable. Petzold writes with the patience of a craftsman who knows his materials, showing how vacuum tubes replaced relays, how transistors replaced vacuum tubes, how integrated circuits packed millions of transistors onto chips the size of a fingernail, and the logic underneath never changes.
The Abstraction Ladder
What struck me most is that every layer of abstraction is there for a reason. Each one exists because people needed to solve a specific problem. Binary, because a switch has two states, on and off. Hexadecimal, because humans cannot read long strings of ones and zeros. Assembly language, because machine code is tedious, and high-level languages because assembly is tedious too.

Each abstraction is a trade. You get expressiveness and speed of development, and you give up control and the knowledge of what the machine is actually doing.
Petzold walked me down the ladder rung by rung until I was standing on solid ground, and from there the abstraction I work in every day stopped looking like magic. It is engineering, choices made by people who came before, each one built on the last.
Dead Ends and Detours
The book keeps the dead ends in the history. Brilliant engineers pursued mechanical computers for decades before electronic ones won. Decimal computing made intuitive sense and binary proved more practical. The von Neumann architecture came out of the constraints of building actual machines more than out of pure theory.
I find comfort in these dead ends. They remind me that progress is not a straight line, that the "right" answer is often only obvious in hindsight, and that what got those engineers through was the willingness to build, test and revise.

Why This Book Matters Now
We are living through another revolution, AI models generating code, agents orchestrating systems, the layers of abstraction growing taller and the foundations more distant.
The foundations are still there under all of it, the ones and zeros, the logic gates, the fetch-decode-execute cycle. Understanding them will not make anyone a better prompt engineer in any direct sense, but it changed how I see the tools I use. I stopped treating them as oracles. They are machines, built by people, machines I can in principle understand.
Petzold told Amazon.com in an interview around the first edition that his main hope was to give readers "a really good feeling for what a bit is, and how bits are combined to convey information." He did that, for me at least, and I have not thought about computers the same way since.
The Book as Object

The second edition, published in 2022, updates the material and adds an interactive companion website that Petzold built himself, where you can simulate the circuits from the book, watch signals propagate and build your own logic gates. A generous addition from an author who clearly loves teaching.
It is a book written by someone who wanted others to share his wonder, with no curriculum to satisfy.
| Detail | |
|---|---|
| Author | Charles Petzold |
| First Published | 1999 |
| Second Edition | 2022 |
| Pages | 393 (first edition), 480 (second edition) |
| Companion Site | codehiddenlanguage.com |
Who should read it
⭐ 4.5/5
Knowing how a transistor works is optional. If you build software or work with AI, or spend your days up in the abstraction, it is worth knowing the ground beneath your feet, and Code is the book that gave it to me, patient and clear and a real pleasure to read. It changed how I think about the machines I use every day, and it may do the same for you.
Related Reading
For more on technology, AI, and computing fundamentals:
- Genius Makers: The Mavericks Who Brought AI to Google, Facebook, and the World - The people and competition shaping modern AI
- The DevOps Handbook - Building reliable systems on computing foundations
- Antifragile: Things That Gain From Disorder - Understanding resilient systems
This post contains affiliate links. Purchases made through these links support this site at no extra cost to you.