Review: From Mathematics to Generic Programming

5.0 out of 5 stars  From Mathematics to Generic Programming (Product Page)

 

(This is a repost of my Amazon review) I’ve been out of college for a while. I did well in math classes in high school and college, but I’ve been recently feeling rusty. I wanted to read this book to combine something I love (generic programming) with something I feel is missing in my daily life (mathematics). I wasn’t at all disappointed.

The book covers a lot of interesting historical stories of advancements, discoveries, and progressions in mathematics. It starts with the cravings of the Greeks to learn and how the study of the world around them incorporated arithmetic, geometry, astrology and other teachings. The book presents many different abstractions via axioms, theories, and proofs. These are then seamlessly related to generic programming.

Although the programming pieces of the book don’t stress this enough, the examples are a guidance toward functional programming concepts. Stepanov covers monoids, groups, semigroups, rings, etc. I was surprised by the amount of ground covered in this book. He even discusses how mathematics can be applied to social networks to do something like find friends of friends of friends (graphs).

The code examples in the book are written in C++. This may be intimidating for some developers. Don’t worry, the code isn’t overly advanced. If you’ve worked with another language that has generics, traits, mixins, or macros, you should be fine. These are the level of abstractions you’ll encounter in this book. There’s an appendix to introduce the C++ concepts, if needed.

There are plenty of exercises in the book. These are actually the only the only negative thing I have to say about the book. There are no solutions, no hints, and no companion code for the book’s exercises. Maybe when the book has been around for a while, you may be able to find a github repo where someone has worked through the tasks. I was sad to see nothing like this existed.

I would highly recommend this book to anyone with an interest in mathematics and an interest in generic programming. I felt like the book was a little heavier on mathematics than generic programming. However, I also feel like most developers I’ve met don’t feel comfortable with the application of mathematics concepts.

Related Articles