Login  Register

Re: Chapter 1 Complete!

Posted by WBahn on Jan 07, 2023; 9:36pm
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Chapter-1-Complete-tp4037022p4037030.html

You've hit on one of the key points of the course -- abstraction.

Imagine having to build the ALU (or, later, the entire CPU) from nothing but a bunch of Nand gates. The human mind has a very hard time working at both the high-level big-picture perspective and the low-level implementation perspective at the same time. We work best when we work at a level of perspective that has just enough detail to get the job done while being able to think in terms of the task immediately at hand.

We do this all the time without even thinking about it. When you set out to do "Spring cleaning", you don't think in terms of cleaning out the top-left dresser drawer. You think in terms of cleaning the bedroom, then the kitchen, then the bathroom. But when you get to the bedroom, you think about cleaning the closet, then the dresser, then the bed, then the desk. When you get to the dresser, that's when you think in terms of the individual drawers and, depending what's in them, you might break it down even more.

The same with the ALU. It's most natural to think of it in terms of the major functional blocks, like an adder, and something to select between different signals, and something to invert all the bits in a signal, and so on. So by implementing the smaller bits of logic so that you have parts that do those things, you have a match between the level of abstraction of the immediate problem and the level of the tools available to solve it.

This becomes all the more important as you walk up the software chain from the assembler to the virtual machine, to the compiler, to the operating system.