Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the authors
OK
Elements of Programming 1st Edition
—Martin Newell, Adobe Fellow
“The book contains some of the most beautiful code I have ever seen.”
—Bjarne Stroustrup, Designer of C++
“I am happy to see the content of Alex’s course, the development and teaching of which I strongly supported as the CTO of Silicon Graphics, now available to all programmers in this elegant little book.”
—Forest Baskett, General Partner, New Enterprise Associates
“Paul’s patience and architectural experience helped to organize Alex’s mathematical approach into a tightly-structured edifice—an impressive feat!”
—Robert W. Taylor, Founder of Xerox PARC CSL and DEC Systems Research Center
Elements of Programmingprovides a different understanding of programming than is presented elsewhere. Its major premise is that practical programming, like other areas of science and engineering,must be based on a solid mathematical foundation. The book shows that algorithms implemented in a real programming language, such as C++, can operate in the most general mathematical setting. For example, the fast exponentiation algorithm is defined to work with any associative operation. Using abstract algorithms leads to efficient, reliable, secure, and economical software.
This is not an easy book. Nor is it a compilation of tips and tricks for incremental improvements in your programming skills. The book’s value is more fundamental and, ultimately, more critical for insight into programming. To benefit fully, you will need to work through it from beginning to end, reading the code, proving the lemmas, and doing the exercises. When finished, you will see how the application of the deductive method to your programs assures that your system’s software components will work together and behave as they must.
The book presents a number of algorithms and requirements for types on which they are defined. The code for these descriptions—also available on the Web—is written in a small subset of C++ meant to be accessible to any experienced programmer. This subset is defined in a special language appendix coauthored by Sean Parent and Bjarne Stroustrup.
Whether you are a software developer, or any other professional for whom programming is an important activity, or a committed student, you will come to understand what the book’s experienced authors have been teaching and demonstrating for years—that mathematics is good for programming, and that theory is good for practice.
- ISBN-10032163537X
- ISBN-13978-0321635372
- Edition1st
- PublisherAddison-Wesley Professional
- Publication dateJanuary 1, 2009
- LanguageEnglish
- Dimensions6.75 x 1 x 9.5 inches
- Print length262 pages
Similar items that may deliver to you quickly
Editorial Reviews
About the Author
Alexander Stepanov studied mathematics at Moscow State University from 1967 to 1972. He has been programming since 1972: first in the Soviet Union and, after emigrating in 1977, in the United States. He has programmed operating systems, programming tools, compilers, and libraries. His work on foundations of programming has been supported by GE, Brooklyn Polytechnic, AT&T,HP, SGI, and, since 2002, Adobe. In 1995 he received the Dr. Dobb’s Journal Excellence in Programming Award for the design of the C++ Standard Template Library.
Paul McJones studied engineering mathematics at the University of California, Berkeley, from 1967 to 1971. He has been programming since 1967 in the areas of operating systems, programming environments, transaction processing systems, and enterprise and consumer applications. He has been employed by the University of California, IBM, Xerox, Tandem, DEC, and, since 2003, Adobe. In 1982 he and his coauthors received the ACM Programming Systems and Languages Paper Award for their paper “The Recovery Manager of the System R Database Manager.”
Product details
- Publisher : Addison-Wesley Professional; 1st edition (January 1, 2009)
- Language : English
- Hardcover : 262 pages
- ISBN-10 : 032163537X
- ISBN-13 : 978-0321635372
- Item Weight : 1.2 pounds
- Dimensions : 6.75 x 1 x 9.5 inches
- Best Sellers Rank: #848,383 in Books (See Top 100 in Books)
- #477 in Computer Programming Languages
- #889 in Microsoft Programming (Books)
- #2,211 in Programming Languages (Books)
- Customer Reviews:
About the authors

Alexander Stepanov studied mathematics at Moscow State University from 1967 to 1972. He has been programming since 1972, first in the Soviet Union and then, after emigrating in 1977, in the United States. He has programmed operating systems, programming tools, compilers, and libraries. His work on foundations of programming has been supported by General Electric, Polytechnic Institute of New York, AT&T, Hewlett-Packard, Silicon Graphics, Adobe, and, since 2009, A9.com. In 1995, he received the Dr. Dobb's Excellence in Programming Award for the design of the C++ Standard Template Library. Alexander retired in February, 2016.
A collection of his papers can be found at: http://www.stepanovpapers.com/
The website for Elements of Programming: http://www.elementsofprogramming.com/
The website for From Mathematics to Generic Programming: http://www.fm2gp.com/

Paul McJones studied engineering mathematics at the University of California, Berkeley, from 1967 to 1971. He has been programming since 1967 in the areas of operating systems, programming environments, transaction processing systems, and enterprise and consumer applications. He has been employed by the University of California, IBM, Xerox, Tandem, Digital Equipment Corporation, and Adobe Systems. In 1982, he and his coauthors received the ACM Programming Systems and Languages Paper Award for "The Recovery Manager of the System R Database Manager"; in 2010, they received the ACM SIGOPS Hall of Fame Award for this paper.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonCustomers say
Customers find the book very good at laying out many of the ways to be abstract, productive, and quick. They also say it's interesting and challenging. However, opinions differ on readability, with some finding it stimulating and interesting, while others say it can be hard to understand and unnecessary complicates simple concepts.
AI-generated from the text of customer reviews
Customers find the book does a good job of laying out many of the ways to be productive and quick. They also mention it's about how to build solid, working, efficient, robust, and reusable products.
"...This book is about how to build solid, working, efficient, robust, reusable, understandable code...." Read more
"...This book can teach ways to be abstract, productive and quick, but this is only first step...." Read more
"...book lives up to its name or not, but for what it's worth it does a very good job in laying out many of the mathematical principles that underly..." Read more
Customers have mixed opinions about the readability of the book. Some mention it teaches ways to be abstract, productive, and quick. However, others say it can be hard to understand, unnecessary complicates simple concepts, and is not an easy read.
"...This book can teach ways to be abstract, productive and quick, but this is only first step...." Read more
"...It is tough to read: it assumes that you are already a good programmer, and you should also be familiar with C++'s template facility...." Read more
"...as it does an excellent job in that department and offers plenty of rewards for the persevering." Read more
"...In its presentations, it emphasizes mathematical and formal analysis. Examples are in C++...." Read more
-
Top reviews
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
It is tough to read: it assumes that you are already a good programmer, and you should also be familiar with C++'s template facility. But if you can make it through this book (at least sketching proofs for the lemmas and giving some thought to the exercises), it will solidify the instincts and idioms you have about programming into a solid conceptual whole that will turn you from a good programmer to a great programmer. You will have terminology to describe (and think about!) many concepts that appear over and over and over and over when programming but which many top-notch programmers only understand at a subconscious, "fuzzy" level, guided by their intuition rather than intelligent discernment.
This book is not about algorithms (although it contains many beautiful and efficient ones), it deals with how *the actual act of software construction* can be brought to a high level of sophistication. Huge parts of this book are *real* C++ code that works today on your C++ compiler (and is also available for download on the webpage for the book). This book is about how to build solid, working, efficient, robust, reusable, understandable code. If you have ever taken higher-level math courses, you will understand that in order to approach mathematics usefully and become a mathematician, you have to really get back down to the things that you took for granted and analyze them more rigorously. This is much the same, but for programming; you will learn how to iterate over elements in a sequence, how to traverse a tree, how to partition a range of elements (but now you will actually know how to characterize the ranges you operate on), how to ... etc. Many of these things will seem "trivial" at first glance to any programmer good enough to be reading this book, but looking back you will realize that when you coded these operations previously, you really had very little understanding about what you were actually doing and that now you have a conceptual framework where all of these actions fit into a broader whole that you are aware of.
If you are a good C or C++ programmer, do yourself the favor of reading this book, especially if you are a C++ programmer that has a knowledge of STL (note that the primary author of this book is Stepanov, the author of STL). Even though it deals entirely in C++, almost all of the concepts translate directly to C unchanged. Basically the only C++ functionality that is used in the book is templates, which merely make the code generic: you will find that concrete instantiations of all of the concepts in this book appear all over the place in C code. Like I said, this book deals with the fundamentals of the act of programming: things that at some level need to be understood by all competent programmers (in particular C and C++ programmers). Do yourself the favor of making your knowledge of these things conscious!
Note: If you are a fundamentalist of functional programming or object-oriented programming, you will probably get very little from this book.
I have never come across problem solving presented in this manor before. The algorithms initially appear quite cryptic but once I read and desk-checked the algorithms they came across as quite clever - who would have thought there was so much to be said about 'power algorithm'. I would recommend this book to anyone who is up for a challenge - who can appreciate code that doesn't have an immediate application to business application development. It is certainly not an easy read and is suited to mathematically minded programmer.
That being said, I do have some complaints. Sometimes the book comes across as overly terse, they give one explanation that's it. It could have used diagrams to better communicate an idea. It lacks an explicit overarching theme and direction.
There is one warning I will give to the prospectus buyer: "The book does not have worked examples, solutions to the exercises, nor does it give proofs for all of the lemmas." This is not a real problem but it breaks the flow of the book as you have to stop and convince yourself that the information presented is correct.
All and all it is a stimulating, interesting and challenging book.
I had been waiting for this book for a while, as I greatly enjoy Stepanov's unorthodox views on programming. His flat rejection of the object-oriented paradigm was what caught my attention, but he differed from the unwashed newsgroup naysayers in an important respspect -- he offered an alternative. The fact that his alternative seemed to involve applying concepts from the realm of abstract algebra to computer programming made me realize I would be spending a lot of time and thought catching up.
This is a short, but dense book. There is little trace of Knuth's sympathetic humor or Dijkstra's aesthetic passion. The material is presented as a series of definitions and sample programs, written in a programming language based on C++. Importantly, there are also exercises and projects throughout each chapter. At first attempt, these puzzlers seem to contain as much insight as the prose itself.
I look at this book as a combination of the two books that Stepanov is known to prescribe to his students, hyper-distilled into a slim few hundred pages:
"The books that I recommend to my students are The Art of Computer Programming by Donald Knuth, which is the great encyclopedia of programming techniques. ... It is something that they should keep studying for the rest of their lives. The other book that I urge my students to read is The Textbook of Algebra by George Chrystal. It is a massive two volume work covering most of elementary algebra. Sadly enough, nowadays even people with graduate degrees in Mathematics do not know most of the material in Chrystal."
More to the point, I look at this book as an intentional challenge. The preface urges the reader to consider why the material absent is absent and vice versa, a sentiment I had only seen in one other place -- Victor Vyssotsky's review of MacLane and Birkhoff. A challenge like that doesn't make for a pleasant exposition, seemingly trading approachability for a more mature understanding.
Stepanov has some great papers in the public domain -- if you are reading this review I highly reccomend seeking them out. Also see the Google Tech Talk "A Possible Future of Software Development" by Sean Parent. If you like those, you will love this.
Top reviews from other countries
This book is fantastic, alas, the poor quality of the Kindle version makes it unreadable: AVOID AT ALL COSTS! It's much better to buy the pdf version from Adison-Wesley themselves, even if it's a bit more expensive.
The book's back cover makes comparison to engineering professions which require formal mathematics theory. These engineering professions have outgrown the medieval apprentice, journeyman, master approach where experience was ultimately gained from trial and error. Software development largely works on this medieval model. Elements of Programming gives some serious mathematical underpinnings to the foundations of software architecture discipline and should be on the reading list of any professional software engineer.
Dense, difficult and requires dedication to read. The nice thing is that it is a book and a citable reference.
n.b. The book's website (hint: it's mentioned on the back cover) has the errata (though not long, they are essential) and a link to a Stanford University video of a talk about the book by Stepanov and McJones (with David Musser in the audience). Watch the video if you have not seen the book, it may affect your decision to purchase.






