Laura Lindzey

robots, science, code


September 04, 2014

My most sustained project at Hacker School was working through NAND2tetris. I finished the whole course, with the exception of chapter 9, because I figured I didn’t need to write a game in Jack when I’d have to write an OS in it later. After seeing a current student ask for peoples’ experiences with the course, I realized that I had more to say than could fit easily in the HS chat program.

Why’d I do it?

I wanted to understand computers at a deeper level, and was insecure about being a roboticist yet not understanding how they work. I have programmed in C, but that’s as low-level as I’d previously gone. I’ve heard a lot of people whom I respect say that their compilers course is where they learned the most. However, when I was an undergrad, I skipped that one (along with Operating Systems) because I wasn’t actually a CS major and only audited the courses that sounded fun, like Algorithms and Decidability/Tractability.

How’d I do it?

Matt Davis and I worked through NAND2Tetris in our batch. We didn’t really work together, but did help get each other unstuck (especially at the start - their hardware emulator had a few quirks) and tried to stay roughly on the same timeline. I found it valuable to have somebody else to feel accountable to for finishing a chapter =) It was also useful to try to explain the concepts to each other, because that’s how I learn.

I think ~10 hrs/week is a reasonable amount of time to spend on it, and probably matches with what I averaged. (I skipped the video lectures and just read the book + used the slides for reference.) It’s also not something you have to finish. Even if you only get through the first few chapters, well, you’ve learned about how computers work down at the hardware level.

Was it worth it?

Of everything I did at Hacker School, I got the most out of this book.

I have a new appreciation for how interesting computers are … previously, I’d mostly viewed hardware (and compilers, and programming languages … really, anything other than higher-level robotics algorithms) as things that I’d prefer to learn as little about as possible.

I also feel like I have enough of an overview of how computers work at all levels to ask questions about what I don’t understand. For example, it opened the door for me to have some great conversations about compilers, while before HS I had a very fuzzy picture of what they even do. The simplicity of the system you implement means that it is very easy to come up with ways to extend the platform or design a new one. It could be interesting to try to move some more of the math into the hardware, or add features to the language.

NAND2tetris is very much a guided tour, meant for an undergrad-level class. It aims to be a broad survey that’ll let the student figure out where they’re interested studying in more depth. The system you build is very carefully designed to be as simple as possible while still being a capable computer. There is very little design involved - the homeworks were more about understanding the provided design (or following the signposts) and implementing it.

I worry that they may provide too much guidance, and that people can work through the assignments without really grokking them. This was especially true for the bytecode translator, which is possible to implement correctly without understanding why the features were needed. I wrote the code for this, but still had trouble remembering how to use the bytecode when I got to the compiler chapter. I often tried to start the projects without reading the final section in the relevant chapter (it always focused on the implementation, rather than the theory.)

Who would I recommend it to?

I think that the only pre-req for this course is an introductory programming course or two. At least, you need to program well enough that understanding the compiler’s operation is the tricky bit, rather than the actual implementation. So, if you were accepted to Hacker School the book probably won’t be above your level, but I did notice a dramatic difference in how much time different people needed for the problem sets based on how experienced we were with programming in general.

If you’ve already taken multiple classes covering microcontrollers/compilers/programming languages, it may be too basic for you (but might also be fun for tying everything together - I’d love to hear from somebody reading it from that perspective!)