Code. The Hidden Language of Computer Hardware and Software

A masterpiece by Charles Petzold

Vardan Grigoryan (vardanator)
Computer Science Reader
4 min readSep 22, 2019

--

Amazon link to the book.

Let’s suppose you are stuck at a desert island. You somehow manage to find food and now you need the second crucial thing to survive: a computer. How could you build a computer without… buying it?

It was my brother who’ve recommended the Code (the book) to me. I’ve read a couple of its chapters, found it ridiculously simple and thrown it away as a “stupid book” not worthy of my time. Years later I will find out that this was the only book (without an exaggeration) that I needed at the time. More than two years I was studying programming through studying C++ (the one and only). It felt good because there are so many concepts in C++ that force you to understand the low-level details of programs. However, there was that barrier that I could never cross. I couldn’t understand how is it that the CPU “understands” that it should subtract variables rather than multiplying. How could it understand that the variable x is at the address 0x12008992, and it should be loaded into one of its registers?

Building a computer became my ultimate dream as a programmer. And that was the perfect time that I was ready to read the masterpiece by Charles Petzold.

Give that dev a cookie?

The book starts with the concept of “codes” and information encoding/decoding, introducing the Morse code, the Braille alphabet and so on. It slowly builds a strong foundation for the reader to move towards zeroes and ones. The author carefully introduces the reader to the binary numeral system and boolean algebra.

After building the required fundament, the book dives into electric circuits and teaches how to build a very simple calculator. The reader will encounter many graphics depicting particular circuits in action.

I've got the colored copy

Eventually, you will be able to build a computer with relays from scratch and with bare hands. That’s a feeling worth everything. After building logic gates using relays and other components, the reader will have her next great moment by understanding how memory works. How can a device actually store even a single bit of information? Though modern systems differ in their complexity and structure from the CPU and RAM built in the book, the very idea that you can build a complete computer with your bare hands (even theoretically) by reading a 400-page book is kind of shocking. The author deserves a VIP spot in heaven.

Finally, the book introduces an assembly language and how would it be run by the “computer” (or the CPU) built in the book. It shows the process of automating the CPU to sequentially execute instructions read from the RAM.

The book finishes with describing a graphical interface and its low-level components but doesn’t dive into the basics as it did with the computer. However, the book can be considered as a complete work that every programmer must read at least twice. After reading the book you will be inspired to build your own computer as did this guy.

Impressing, isn’t it? (though it’s built on relays).

Final score

Useful for programmers: 10/10

Fundamental knowledge: 11/10

Real-world projects and examples: 6/10

Detailed and friendly: 10/10

Worth buying: 10/10

--

--