From Mathematics to Generic Programming By Alexander A. Stepanov
If you are really interested in the mathematical discipline of abstract algebra, and you are really interested writing code that is both efficient and has the widest possible application, and you can read C++, then this is the book for you. From Mathematics to Generic Programming This is a book of mathematics for computer programming or a book of computer programming for mathematics? Simply perfect... If I have to wrote a book, I liked wrote this... :) From Mathematics to Generic Programming Nice read from the STL man himself, Alexander Stepanov. Focuses too much on introductionary stuff (and gcd). From Mathematics to Generic Programming Very good book has really inspired me on many levels by its mathematical depth (which was set just about as far down as I can go) as well its breadth with the historical interludes were fascinating and stimulating. I wasn't sure where it was going when it started with GCD and Egyptians but it worked really well. A genuinely good read as well as reference and a store of multiple jump off points into further reading. From Mathematics to Generic Programming I wonder what’s up with C++ Concepts these days... From Mathematics to Generic Programming
For those of us who need a refresher-- and a bit more.
Computer programming is a wholly mathematical pursuit. Although many computer science departments are housed in engineering, the heart and soul is abstract mathematics.
This book reminds us that a computer only does what it is told to do-- and told in a proper fashion. While the present tends fall towards AI --- this book takes a decidedly different tact---- It gives us the rudimentary basics of computer security-- whose fundamentals rest in Abstract Algebra. It is a joy to read. From Mathematics to Generic Programming Very cool book which builds a bridge between abstract algebra, and template functions in C++. From Mathematics to Generic Programming Depends on what you expect
I was very enthusiastic about this book when it was first announced. My expectation was that author will give some introduction to mathematical constructs related to program composition that comes from category theory and functional programming, like monads, applicatives, traversables and so on. Instead I found all familiar view on algebra, things ike groups, rings, some number theory and cryptography.
However despite my own dissatisfaction I can't avoid mentioning that book is exceptionally well written. Through historical view on mathematics development author achieved very whole and capturing story. I spent some fun good time reading it.
Bottom line: read it if you want to get familiar with abstract algebra and number theory. Or if you want some good time reading about history of mathematics. From Mathematics to Generic Programming This book outlines the mathematical foundations of abstract algorithms very well. The path from abstract algebra to abstract algorithms is outlines quite well.
What I think was not so compelling is the amount of time spent on the details of numbers theory which I don't think helps the narrative a lot.
I feel going deeper in the foundation of types and their connection to generic programming (like touching on category theory) could have been more informative than going so deep in the numbers theory aspect of so many examples.
I may just not represent the intended audience for this book. From Mathematics to Generic Programming “As long as algebra and geometry have been separated, their progress have been slow and their uses limited, but when these two sciences have been united, they have lent each mutual forces, and have marched together towards perfection.” ~ Joseph Louis Lagrange
What does geometry, abstract algebra, number theory and generic programming have in common? This book attempts to answer that by starting at the early stages of organized mathematics and going all the way forward to the 1960’s. The way I thought about Stepanov’s approach is that he attempts to generalize algorithms and shows how algorithms in many respects can be used as axioms. In other words, generalization is not just merely a time saver, but more crucially is a way to ensure rigorousness.
“Mathematics is a game played according to certain simple rules with meaningless marks on paper.” ~ David Hilbert
In many ways this book is just Stepanov removing the paper. The fact that he uses C++ code is irrelevant. I used Python and Java, without having used C++ in years and it was sufficiently trivial that I could follow along. The Euclidean algorithm(greatest common denominator) is the main tool of Stepanov of this book, may be used too much. Algorithms have existed, as he says for as long as we’ve been doing math. The fact that computers use them is historically new, not the norm. Turns out that mathematicians have developed great methods for analyzing such algorithms and the Euclidean algorithm is used exhaustively in a variety of ways to illustrate both the axiomatic nature of algorithm reuse but also how we might do analysis on such algorithms.
If you’ve read my review for Dijkstra's A Discipline of Programming you might remember the line I said: “abstraction is not a nebulous idea, but how we’re absolutely precise.” That's what what Stepanov, like Dijkstra is trying to get across here. Just because we are reorienting our thinking does not mean we lose rigorousness, in fact it's how we ensure it. I'm taking a lot of Calculus in my undergrad so an algorithm I use daily is the Hessian Criterion or second derivative test, I followed along with Stepanov's writing by implementing that algorithm in SymPy then analyzing it. This is what I recommend you do with this book, don't simply copy his examples and expect to get some kind of understanding through wrought memorization but explore what he’s talking about with your own work. It's much more rewarding and more in line with what I think the author was trying to get across by including the examples to begin with.
Pursue what you're interested in, keep working hard, pay attention to what's going on around you and be flexible-these are the rules. Sometimes it works, sometimes it doesn't. ~ Nathan Seiberg From Mathematics to Generic Programming
Alexander A. Stepanov Õ 8 summary
In this substantive yet accessible book, pioneering software designer Alexander Stepanov and his colleague Daniel Rose illuminate the principles of generic programming and the mathematical concept of abstraction on which it is based, helping you write code that is both simpler and more powerful. If you're a reasonably proficient programmer who can think logically, you have all the background you'll need. Stepanov and Rose introduce the relevant abstract algebra and number theory with exceptional clarity. They carefully explain the problems mathematicians first needed to solve, and then show how these mathematical solutions translate to generic programming and the creation of more effective and elegant code. To demonstrate the crucial role these mathematical principles play in many modern applications, the authors show how to use these results and generalized algorithms to implement a real-world public-key cryptosystem. As you read this book, you'll master the thought processes necessary for effective programming and learn how to generalize narrowly conceived algorithms to widen their usefulness without losing efficiency. You'll also gain deep insight into the value of mathematics to programming--insight that will prove invaluable no matter what programming languages and paradigms you use. You will learn about
How to generalize a four thousand-year-old algorithm, demonstrating indispensable lessons about clarity and efficiency
Ancient paradoxes, beautiful theorems, and the productive tension between continuous and discrete
A simple algorithm for finding greatest common divisor (GCD) and modern abstractions that build on it
Powerful mathematical approaches to abstraction
How abstract algebra provides the idea at the heart of generic programming
Axioms, proofs, theories, and models: using mathematical techniques to organize knowledge about your algorithms and data structures
Surprising subtleties of simple programming tasks and what you can learn from them
How practical implementations can exploit theoretical knowledge From Mathematics to Generic Programming