Reader Q&A: Book recommendations

Vigen Isayan emailed me today to ask:

What book(s) you would recommend for learning

1. design patterns, and

2. concurrency programming.

Off the top of my head:

1. For Design Patterns, the greatest is still the original “Gang of Four” Design Patterns book. The design patterns are mostly universal, and the implementations happen to focus on OO techniques (dynamic run-time virtual dispatch etc.) but you can also express many of the patterns using generic programming (static compile-time templates etc.) – for example Observer becomes really simple. The book is almost two decades old, has inspired huge numbers of follow-on patterns books, and there’s still none better of its kind that I know of.

2. For concurrency (and parallelism), check out my 33 articles on Effective Concurrency. I hope to assemble them into a book in the near future. In the meantime they’re all out there online freely available.

If you have additional recommendations, please post them in the comments. Thanks.

On a personal note

Speaking of the Gang of Four, here’s a personal story I don’t know if I’ve shared on the blog before:

At the time it first came out, I was working in downtown Toronto. We had a really excellent local bookstore that specialized in programming books and magazines (alas, it’s long gone now). On lunch breaks, I would go there to browse and get new books to absorb. Note that this was before I was a published author myself, and I had no idea about major new books coming out, so I had no warning of what was about to happen.

On one day that at first seemed like any other, at lunchtime I was browsing the shelves as usual, and I saw copies of a white and blue hardcover book I’d never seen before. Curious, I picked up a copy. It had an unusual title, Design Patterns. I had never heard of the book or its authors before, knew nothing about it at all, and so was quite unsuspecting when I opened it and something happened that I had never experienced before and haven’t experienced since (so far):

I opened that book for the first time, stood there paging through it for less than five minutes, and knew immediately and profoundly that I was holding a classic in my hands. The realization was so unexpected and surprising, it hit me almost physically. At first sight, it was as easy to recognize this book as an important leap forward as the first you see an airplane flying in the sky. Scales fell from my eyes: Cataloguing OO design problems and their known solutions! Imagine!

I had already learned a few of the patterns on my own here and there, some through hard work and experience, others by combining ideas from various articles, many by working with experienced colleagues. But suddenly I found myself standing there in the bookstore aisle just absorbing one problem and solution after another after another, and feeling my understanding begin expanding. Even the patterns I sort of knew about were explained with concise clarity: Motivation, the problem and the specific constraints on the solution which are so important because they affect the design. Known solutions. Variations with tradeoffs.

Bliss! No, more than bliss — treasure.

This must be what explorers and hunters feel like when one day unexpectedly they discover an unopened and unransacked tomb of a young Egyptian Pharaoh, a sunken treasure galleon filled with precious cargo and artifacts, or a cave near the West Bank containing well-preserved two-thousand-year-old scrolls of important literature.

And Design Patterns was language-agnostic, to boot.

Nineteen years later, it’s still at the top of my list of design books to recommend.

Disclaimer: Something this profound inspires a whole new subculture. Later “pattern” wannabe books often went way, way, way overboard, some of them almost to the border of quasi-mysticism. Ignore most (not all, but most) of the follow-on pattern books. Only a few are worth your time; read the reviews carefully first.

8 thoughts on “Reader Q&A: Book recommendations

  1. For concurrency I gained most reading the SPARC Architecture Manual http://www.amazon.com/SPARC-Architecture-Manual-Version9-International/dp/0130992275 especially details on relaxed memory models, the memory barriers and the assembly examples to create primitives like mutex, semaphore correctly.
    And after that one can learn to do it with C++ from C++ Concurrency in Action http://www.amazon.com/C-Concurrency-Action-Practical-Multithreading/dp/1933988770 that explains both theory, the new C++11 features and even provides some useful global tips.

  2. I like “Agile Software Development: Principles, Patterns and Practices” by Robert Martin a very good one. Though it is not focused only on patterns, but I consider it a classic.

  3. The Gang of Four book is definitely a classic, particularly as an academic study of design patterns, but I frankly got more value learning and understanding design patterns from Head First Design Patterns. It doesn’t hurt that it has a cute girl on the cover, something you rarely get in programming books.

  4. I would recommend Fowler’s book “Patterns of Enterprise application architecture”.. It’s a bit domain-specific (databases), but it stays very true to the spirit.

    Also by Fowler, the “Refactoring” book was the first time I saw rewriting OO software as a sequence of testable, small atomic steps. Helped me immensely.

  5. Hello, Herb. Thank you for recommendations. Could you tell please, is there a good book/articles which explain compile-time patterns? (Not regarding Alexandrescu’s “Modern C++”)

  6. Design Patterns: “Head First Design Patterns” for getting into design patterns thinking. GoF book is the definitive authority. Gurus can skip the first book. The GoF book is outdated regarding C++11. For a consciousness-expanding view from a C++11 perspective check out Tobias Darm’s presentation “Effective GoF Patterns with C++11 and Boost” (not a book, but awesome anyway, even though a few code examples on the slides are incomplete): http://www.infoq.com/presentations/gof-patterns-c-plus-plus-boost

    Concurrency: “C++ Concurrency in Action” and Herb’s articles.

  7. What I have found useful, and much in line with what others have posted before me, are the following:

    1) “Pattern-Oriented Software Architecture Volume 2: Patterns for Concurrent and Networked Objects.” For me, this book is analogous to the “GoF” book but for concurrency: it details the fundamental patterns and idioms folks use to build concurrent systems in the same format as “Gang of Four” Design Patterns book.

    2) C++ Concurrency in Action.

    3) “Is Parallel Programming Hard, And, If So, What Can You Do About It?” Edited by Paul E. McKenney. It is the most thorough discussion of modern issues and techniques that I have seen. You can find the updated versions on the web: ftp://kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html

    I reckon it is obvious, but I read the mighty Herb Sutter too.

    Take care,
    mike vitalo

  8. Is there any way to get all 33 concurrency articles short of signing up for Dr. Dobbs (they limit how many articles unregistered users can view)? I have this kooky but handy policy of never signing up for something I don’t foresee using again later (keeps my accounts manageable), but this would be one of those cases where said policy is something of an inconvenience to me…

Comments are closed.