The 2009 book, Elements of Programming, by Alexander Stepanov and Paul McJones, is an introduction to programming grounded in the mathematics that underlie the algorithms from which programs are built. Unlike many programming texts, which present the mechanics of programming first and then later explain their mathematical foundation, this book puts the mathematics first and then uses the C++ language, including its template (generic) features, to show how abstract algorithms are embodied in code. The authors describe their goals in the preface as follows.
This book applies the deductive method to programming by affiliating programs with the abstract mathematical theories that enable them to work. Specification of these theories, algorithms written in terms of these theories, and theorems and lemmas describing their properties are presented together. The implementation of the algorithms in a real programming language is central to the book. While the specifications, which are addressed to human beings, should, and even must, combine rigor with appropriate informality, the code, which is addressed to the computer, must be absolutely precise even while being general.
As with other areas of science and engineering, the appropriate foundation of programming is the deductive method. It facilitates the decomposition of complex systems into components with mathematically specified behavior. That, in turn, is a necessary precondition for designing efficient, reliable, secure, and economical software.
The book is addressed to those who want a deeper understanding of programming, whether they are full-time software developers, or scientists and engineers for whom programming is an important part of their professional activity.
The original publisher decided to discontinue the book and reverted the copyright to the authors. They re-typeset the book in LaTeX and have made it available as as a free downloadable PDF or, for those who prefer paper, a paperback available from Amazon. All available editions, including Japanese, Russian, Chinese, and Korean translations, are available from the authors’ Elements of Programming Web site.