Nerd Business

10
Nov
2011

Learn programming using wire, light bulbs, a battery, and telegraph relay

I'm currently reading quite possibly the coolest programming book ever written. The book is not teaching Python, nor C, and not even Assembly. Rather, the book is teaching Morse code. And electricity. And how these two concepts can be brought together to make anything from telegraphs to modern day computers.

If you're like me and are trying to take your programming skill to the next level, this might be exactly the kind of foundational knowledge you need.

The book is called CODE. I first got wind about it last week, after reading The Book That Every Programmer Should Read on Grigory' blog. Indeed, Grigory recommended every programmer read it - not because of what kind of new techniques you can learn, but rather, because of the broader understanding you will gain from this truly fundamental lesson on how computers work.

CODE

Of course, computers aren't programmed with Morse code. But, as author Charles Petzold will show you, it's the concepts that count. Morse code was like a first iteration of the modern day programming languages we see today. And telegraphs were like the first computers. Yet he doesn't just start there. He goes deeper... drilling down into the underlying concepts of both.

Without spilling the beans on everything included in the book (which by the way, I'm not even halfway through), in this post I'm going to share with you just a sliver of the concepts covered.

How electricity works

The book will explain to you how electricity works. And how the flow of current can be controlled. Such as by merely touching two ends of a wire together (closed loop) or un-touching them (open loop).

open loop

Using a series of fun examples, Petzold will guide you along to the advent of the telegraph and how electricity - along with the two most basic electrical components: a switch and a relay - were used to create it. Like many, I did not know how a telegraph worked. But it's surprisingly simple, and Petzold's teaching style makes for an engaging read.

When circuits meet code

Once you know electricity, you should know some Math. Petzold will show you how math can be used to represent any language, including Morse code. Interestingly, Morse code is actually more complex than binary code - the language of computers and foundation of all programming languages.

What makes binary code more useful is that it operates in the same way as the flow of electricity. It's either off or on. 0 or 1.

electrical switches

 

Eventually, you'll actually "see" binary code in a physical implementation of an electric circuit. And you'll understand how these circuits can be made even more complex - using nothing but binary (and some boolean logic). And with this, you'll understand the very basics of how computers work.

Boolean logic

 

For me, there were a number of clear "ahah" moments I experienced while reading. And I think that's a pretty good indicator of a great book. Furthermore, Petzold's teaching style is quite fun - and a refreshing change of pace from the typical linear curve of increasing complexity most education literature has. Rest assured, things do get more complex as you read deeper into book - yet each chapter has a unique way of introducing a new concepts.

CODE - The Hidden Language of Computer Hardware and Software

By the way, if after reading the book, you get the itch to design your own electronics - I might recommend you check out Upverter. They're a YC startup with a web based product made for that very purpose.