Notes on Programming

by Alexander Stepanov



In this book I will use C++. The main reason for that is that it is combines two essential characteristics: being close to the machine and powerful abstraction facilities. I do not believe that it is possible to write a book that I am trying to write without using a real programming language. And since I am strongly convinced that the purpose of the programming language is to present an abstraction of an underlying hardware C++ is my only choice. Sadly enough, most language designers seem to be interested in preventing me from getting to the raw bits and provide “better” machine than the one inside my computer. Even C++ is in danger of being “managed” into something completely different.


Starting at the bottom, even at the level of individual instructions, is important. It is, however, equally important not to stay at the bottom but always to proceed upwards through a process of abstraction. I believe that every interesting piece of code is a good starting point for abstraction. Every so-called “hack,” if it is a useful hack, could serve as a base for an interesting abstraction.


It is equally important for programmers to know what compilers will do to the code they write. It is very sad that the compiler courses taught now are teaching about compiler- writing. After all, a miniscule percentage of programmers are going to write compilers and even those who will, will quickly discover that modern compilers have little to do with what they learned in an undergraduate compiler construction course. What is needed is a course that teaches programmers to know what compilers actually do.