Thursday, January 05, 2012

Book Review: The Elements of Computing Systems

Want to really, truly understand how computers work? Read "The Elements of Computing Systems", by Noam Nisan and Shimon Schocken.

I studied Computer Science through graduate school. I love the field, and I own the texts that make this field fun. So I was surprised when this book came from nowhere. It promised to teach Computer Science completely through building an entire computer from the most basic pieces. After reading through it, and doing most of the exercises, I am convinced. This is the way to teach Computer Science. This way doesn't come easy, a high school student could go through it, but he would need a lot of exposure to Computing concepts in advance: flip-flops, how a VHDL-like language works, and programming. An undergraduate student could start on this book in this third year. It forms the textbook for a course at MIT. Lucky students.

The most important concept in Computer Science is abstraction: how a layer of abstraction can hide the underlying complexity. This is a difficult concept to grasp in practice, though you see it everywhere. A CPU is an abstraction layer: you program it in Assembly, and assume that it is a magical box that "understands" assembly. The CPU itself is built using transistors and logic gates. Computer Science is built on many abstractions: a memory, a processing unit, a lower-level language, a compiler, an operating system.

The Elements of Computing Systems is written in a very interesting way. It starts out with logic gates and a flip-flop as the basic unit. Using these, you create all the complexity of an adder, a register, a simple arithmetic unit. Using your creation, you create a full CPU. Using your CPU, you use an assembly language to program it. For your assembly language, you write a compiler, and then an operating system. This shows you the entire stack for a make-believe computer. The computer made is a simpler version of your laptop or desktop. Knowing one allows you to understand the more complex version.

This method of learning by doing is very powerful. This is the only way this understanding sticks in the minds of students. I've seen many of these topics covered in separate Computer Science coursework. But a single book tying the topics together has more impact.

This book isn't for everyone. You will need some experience with a C or Java like programming language, and perseverance. A smart high school student could tackle this with some help from his parents. I cannot think of a better way to learn computing.