
Elements of Programming (2009) - signa11
http://elementsofprogramming.com/
======
nly
If you want an intro to the content of this book you can checkout Stepanov's
phenomenal lectures on A9:

"Efficient Programming with Components" \-
[https://www.youtube.com/playlist?list=PLHxtyCq_WDLXryyw91lah...](https://www.youtube.com/playlist?list=PLHxtyCq_WDLXryyw91lahwdtpZsmo4BGD)

"Programming Conversations" \-
[https://www.youtube.com/playlist?list=PLGvfHSgImk4Y1thqJLpcS...](https://www.youtube.com/playlist?list=PLGvfHSgImk4Y1thqJLpcSscMTwgN-
XM9l)

I warn you though, this is a philosophical and painstakingly detailed intro in
to this way of thinking that takes an entire series of videos to build up a
single algorithm, in C++, bit by bit, episode by episode. It also happens to
be one of my favorite lecture series.

------
codr7
I like Stepanov, he shows integrity. And I'm ever grateful for his influence
on C++.

I'm also fairly experienced, having spent the last 30 years or so writing
code. Every kind of code you can think of in any language. Which means I'm
fairly used to juggling abstractions.

But I just couldn't crack this one, I lack the motivation needed to work this
elevation for extended periods of time. I need some kind of real-world
connection now and then to make sure what I'm learning is at all useful.

I got the book when it just came out, and haven't tried since, but I'm pretty
sure the problem persists. I have even less patience with academic
abstractionitis these days.

I would be very interested to learn how and why people find the information
contained in the book useful.

~~~
mempko
After reading this book, I built a high throughput, multi-threaded processing
system in C++ that didn't use any mutex because I was able to define my
operations as both commutative and associative. Because I was able to start
thinking at that level thanks to this book it led me to a better design of my
system.

It's worth reading, you will get something out of it! But it is a lot of work!

~~~
_fullpint
That's really cool!

Do you mind maybe explain how you were able to communicative and associative
props to avoid using semaphores/mutex?

There seems to be a lot of complaints here about the formality of it all. My
preference is usually for more formal literature, just because it tends to
lend for a more powerful tool for me. With that said, did you find it to be
too formal?

~~~
mempko
those properties allow you to divide up work on data in a way that guarantees
that no two processes will work on the same data at the same time. You can
then take data, divide it up, use 'const correctness' in the language to
guarantee original data doesn't change and then you don't need a mutex because
you know only one thread is working on that piece of data.

A typical approach is if you can divide your algo into map/reduce, you can do
this. Going back to the properties of you computation allows you to reason how
to apply something like map/reduce.

------
rramadass
This book is non-trivial. Programmers without a background in Mathematics
should take care not to be intimidated by the formalism and lose heart while
studying this book (i myself have not finished it). Some knowledge of Discrete
Mathematics, Logic and in particular; Abstract Algebra are prerequisites. I
can recommend
[https://www.amazon.com/gp/product/0201179571/ref=dbs_a_def_r...](https://www.amazon.com/gp/product/0201179571/ref=dbs_a_def_rwt_hsch_vapi_taft_p1_i0)
for the reqd. background. It is one thing to know mathematical concepts and
quite another to know how to apply it to programming. That is where this book
comes in.

------
blondin
OMG, that's great. i have the follow-up book, from mathematics to generic
programming -- hardcore read for someone who is no expert at maths or
cplusplus but still a phenomenal read.

i have had elements of programming on my wishlist for a while and saw the
price skyrocketed on amazon. the book is being sold used for $200+ on amazon
right now. i am just going to get the lulu paperback because that's a steal
right now. big fan of Alexander Stepanov.

~~~
winter_blue
Wow, thanks for sharing your recommendation. I would not have considered
reading this book, if I hadn't read your comment.

And I'd never heard about _From Mathematics to Generic Programming_. I'm
definitely going to check it out! It seems like a really cool book.

~~~
maxlybbert
While you won’t have any trouble finding “From Mathematics to Generic
Programming,” you may be interested in the book’s website,
[http://www.fm2gp.com/](http://www.fm2gp.com/) , which includes a sample
chapter and links to interviews about the book, including one with Lakos:

“John: ... How — and please be brutally honest — would you contrast your
experiences of co-authoring a book with Dan versus Paul?

“Alex: The goals of the books were quite different. Both books have their
place.

“Paul convinced me that it is essential to write a very formal treatise in
order to unambiguously define the foundations of generic programming. He
thought that the conversational style of my lectures undermines the
seriousness of the subject. I agree with him. We wrote a very terse, but — in
my opinion — elegant book. Some people appreciate it; but it is clearly not
for everyone. I am very grateful to Paul. He is and will always remain my
close friend. I would gladly collaborate with him on another book.

“Dan had a different idea. He thought that what was needed was a more
accessible book, and I agree with him as well. And he led the work in such a
direction. I would love to collaborate with him on another book as well.”

------
adamnemecek
This book is really good, really dense but the ideas have inspired a
generation.

In this video, Sean Parent, at the time working at Adobe on Photoshop,
estimated that if PS codebase followed ideas from this book, the codebase
could be reduced from 3,000,000 LOC to 30,000 LOC.

[https://www.youtube.com/watch?v=4moyKUHApq4&t=39m30s](https://www.youtube.com/watch?v=4moyKUHApq4&t=39m30s)

~~~
agumonkey
so if you put Sean Parent and Alan Kay in a room, they'd reduce the sum of all
programs running in the world into a single floppy

------
User23
Stepanov's work on the STL was revolutionary. I personally came to
mathematical programming via the Dijkstra/Scholten route, but this is an
excellent work at an unbeatable price.

~~~
_pmf_
Programming using std::algorithms feels very mathy in general (for better or
worse).

------
danharaj
This book was a huge influence on me when it came out.

~~~
agumonkey
Any similar books come to your mind ?

~~~
danharaj
If you mean something that's influenced my way of thinking: not a book, but
some transcribed lectures: On the meanings of the logical constants and the
justifications of the logical laws by Martin-Lof [0]

If you mean something that takes a very mathematical approach to deriving
programs: Algebra of Programming by Bird and de Moor [1]

[0] (pdf)
[https://ncatlab.org/nlab/files/MartinLofOnTheMeaning96.pdf](https://ncatlab.org/nlab/files/MartinLofOnTheMeaning96.pdf)

[1] (pdf)
[https://themattchan.com/docs/algprog.pdf](https://themattchan.com/docs/algprog.pdf)

~~~
agumonkey
Thanks, these looks great

------
jchook
It seems clear that theories of software should continue to develop this level
of formalism if we ever hope to trust it with our lives (eg software-piloted
automobiles, safety mechanisms, nuclear technology, etc).

Imagine if car manufacturers had formal proofs of their claims regarding self-
driving car software and it’s predictability / reliability. This is not a
situation for trial-by-error.

------
sean_the_geek
Thank you very much for posting the link! This book is phenomenal. The prices
for previous editions were pricing me out; now ordered a paperback for myself.

