From Mathematics to Generic Programming” review. A book by Alexander Stepanov and Daniel Rose. Published by Addison-Wesley.

## Book review

Let the title of the book, From Mathematics to Generic Programming, doesn’t confuse you. My first impression after seeing it was that the book will teach me how to write generic code including constructs like iterators and the mathematical theory being behind them. After reading it, it turned out that the book is in fact not about what I had excepted from the title. From Mathematics to Generic Programming is really a book about mathematics in programming in general, with focus on mathematics behind the generic programming. There is not much about generic programming itself. A much better title would be “The Mathematical Theory behind Generic Programming”.

If you are looking for a book about generic programming, you may be now wondering if you should get this book or not. The answer to this question is, in my opinion, definitely yes. From Mathematics to Generic Programming may not contain much about generic programming itself, but it contains a lot of well explained concepts from the mathematical background of generic programming. All of this theory is a fundamental that allows to truly understand the concept behind the generic programming.

From Mathematics to Generic Programming will teach you how to practically use various mathematical axioms, theorems, structures, algorithms and techniques that are very useful not only in generic programming, but in general programming as well. Starting with as simple concepts as ancient multiplication algorithms, through monoids, groups, rings or fields, the book will get you to the point where you will be able to very easily understand how RSA algorithm works and even to implement it yourself.

The book is written in light non-academic style, rather than in style of academic technical books. It is filled with short biographies of important mathematicians along with stories about how they developed the knowledge that strongly influenced generic programming. All of that make this book a very interesting read, making the entire experience of reading it similar to reading a history book. You simply don’t want to put the book away, because you are very curious of what is next in that great history of mathematics. After finishing the book I placed orders for next books, like Euclid’s Elements, because the author really made me interested in pursuing more knowledge about the topics he wrote about.

Since this is a book about mathematics, you may be wondering what prerequisites are needed to understand it. The good news is that anybody who understand high-school mathematics should have no problem with reading it. If you think that your knowledge is a little rusty, read about high-school-level algebra and geometry to recall most of the information you need. Beside mathematics, you will need some basic knowledge of C++ to understand the code examples (there are not much of them, however). The examples are simple enough to make them understood by non-C++ programmers. If you program in languages with a similar syntax, like Java, then you should have not much trouble with them. In case you would have any troubles with the examples, on the end of the book is an appendix “C++ for Non-C++ Programmers” which should dispel any doubts.

In a summary, the book is a great and unique position for people wanting to learn the mathematical theory behind generic programming, or learn about mathematics in computer programming in general. While this book will not teach you how to write generic code, it will teach you fundamental knowledge that will allow you to understand the concept behind generic programming. As mathematics is the fundamental of computer programming, learning mathematics is a certain way toward becoming a better programmer.

I have really enjoyed the book and I recommend it for anybody who wants to become a better programmer or wants to better understand generic programming.