Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
From mathematics to generic programming
Stepanov A., Rose D., Addison-Wesley Professional, Upper Saddle River, NJ, 2015. 320 pp.  Type: Book (978-0-321942-04-3)
Date Reviewed: Jan 22 2015

I first started programming in C++ in the early 1990s. At that stage, C++ was a better C. C++, or C with objects as it was known in its earliest days, has always supported object-oriented programming. However, it was only later that support for templates (or generic programming) came to C++. For me and many others, generic programming was only an interesting language feature, not a major new way of programming. Then, in the mid 1990s, a new library appeared called the Standard Template Library (STL), written by Alexander Stepanov and Meng Lee. All of a sudden, there was a whole new way to program, and for me at least, a much better way to compose programs. From the start, STL had an elegant design and offered the trinity of algorithms, iterators, and containers.

Reading about Stepanov, and in particular one interview with Graziano Lo Russo [1], made two things very clear: (1) Stepanov is a very bright person, and (2) he brought his very strong mathematical background to bear on the design of STL.

When I started reading this book, I expected at most half of it to be on mathematics and then the rest to be all about generic programming. Instead, I was pleasantly surprised. This book is mostly about mathematics and a lot about generic programming. The book focuses mainly on number theory and abstract algebra. It starts near the beginning a few thousand years ago and proceeds mostly in chronological order. Each chapter, roughly, introduces a new concept and talks about the mathematician who influenced it. So, there is a chapter on Greek number theory and Pythagoras, Euclid’s algorithm and Euclid (the chapter also mentions Plato and Leonardo Pisano, also known as Fibonacci). It then moves on to modern number theory, discussing Fermat and Euler. As each new mathematician is introduced, a short vignette gives some context to their lives and their work. Most of these mathematicians should be familiar to most people who have studied mathematics and number theory. I have to admit, though, that I had not previously come across Emmy Noether.

All the mathematics is very accessible to a person with a reasonable background in math. I have previously done courses at the university level in number theory, and so found most of the material familiar. It’s difficult to say how hard it would be for someone with no previous exposure, but I suspect that s/he should be fine. There are a few sections where the author says there is some advanced math ahead and the reader should feel free to skip it. Of course, I read these sections, and they should be fine for most people with some mathematics background.

On the code side of things, there is probably a lot less code than mathematics. The author uses C++ as the language of choice, but the code is concise enough that it should be readable and comprehensive to anyone who has experience in other languages such as Python, JavaScript, or Java (although users of more dynamically typed languages may wonder what all the fuss is about).

The examples focus on code for finding the greatest common divisor (GCD). This example runs through several chapters and illustrates how a generic approach leads to better code. It also illustrates the analogies between generic code with its “concepts” and “traits,” and abstract algebra with its “groups” and “rings.”

While I enjoyed this book tremendously and learned a lot from it, mostly about taking an idea and abstracting it mercilessly, I am not quite sure of the audience. I think that programmers with little interest in math may find it too mathematical, and people interested in math may not get the programming. There exists a group of people who will find this book very enlightening. The book could possibly be used in a computing course--there are some exercises, but not enough to suggest that the book was conceived as a textbook.

Given the title, a prospective reader may wonder: Will I be a better programmer after reading this book? The answer for me was yes.

More reviews about this item: Amazon, Goodreads, i-Programmer

Reviewer:  Martin Schweitzer Review #: CR143104 (1505-0330)
1) Stepanov, A.; interview by Lo Russo, G. An interview with A. Stepanov. http://www.stlport.org/resources/StepanovUSA.html (Accessed 01/22/2015).
Bookmark and Share
 
General (D.0 )
 
 
General (D.2.0 )
 
 
General (G.0 )
 
Would you recommend this review?
yes
no
Other reviews under "General": Date
The habit-forming guide to becoming a systems thinker
Benson T., Marlin S.,  Systems Thinking Group, Inc., Pittsburgh, PA, 2017. 152 pp. Type: Book (978-0-997883-41-1)
Nov 20 2017
Android how to program (3rd ed.)
Deitel P., Deitel H.,  Pearson, London, UK, 2016. 848 pp. Type: Book (978-0-134444-30-7)
Apr 11 2017
How software works: the magic behind encryption, CGI, search engines, and other everyday technologies
Spraul V.,  No Starch Press, San Francisco, CA, 2015. 216 pp. Type: Book (978-1-593276-66-9)
Mar 23 2016
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright © 2000-2018 ThinkLoud, Inc.
Terms of Use
| Privacy Policy