### 10 Non-C++ Book Recommendations for C++ Programmers

Friday, January 19th, 2018So you’ve learned enough C++ to function. You’ve read a bunch of the usual recommendations: Meyers, Stroustrup, maybe even Alexandrescu and Stepanov. You know enough to recommend Lippman et al. to newbies rather than the other “C++ Primer.”

The internet has lots of C++-related book recommendations to make — for example, you should absolutely read all the authors listed above — at whatever C++ developmental stage is appropriate for you. But since you can already find so many C++-specific book lists out there, I’d like to recommend some books perhaps a bit further off the beaten track that should nevertheless be interesting and help you become a better programmer in C++ or any other language. C++ is a multiparadigm language, and there is a lot outside of the usual C++ ecosystem that is valuable to learn.

These recommendations fall broadly in two categories: books about specific areas of programming, mathematics, or computer science; and books about the history of the subject and industry. There is some overlap between these categories, and I believe that all of my recommendations will either give you extra tools to use or at the very least add context to your endeavours. I can earnestly say that I have read every single one of the books I’m recommending here, although some are now available in editions that have evolved since I last read them.

In no particular order:

*Dealers of Lightning: Xerox PARC and the Dawn of the Computer Age* – Michael A. Hiltzik

I’m kicking off the list with a historical recommendation. As programmers, we tend to exalt the new and pay little attention to the old, but it pays to study the history of the field — *nihil sub sole novum*, after all. *Dealers of Lightning* follows the history of Xerox PARC, the place where luminaries like Alan Kay and Butler Lampson pioneered a few small things you’ve probably heard of, like laser printers, personal computing, ethernet, and GUIs. If your only experience with “object-oriented programming” is the way it’s done in C++, well… yeah. You should study history.

*A Book of Abstract Algebra* – Charles C. Pinter

Perhaps, like me, you have a mathematical background that ends somewhere around high school or your first year of university. Maybe you’ve heard of things like monoids, rings, or groups being used in the context of programming and wondered why smart people like Alexander Stepanov seem to talk about them so much. If you want to fill in the gaps in your knowledge, this is the book for you. One slight word of warning: it is dense, and it is mathematical. The good news is that it is also very accessible. Most of us without university-level mathematics under our belts haven’t studied abstract algebra at all, but it doesn’t really require anything beyond a comprehension of junior high mathematics to get started. When I was a teenager, calculus was hard. As an adult, I’ve been able to expand and enrich my experiences in the physical world, allowing me to make more of the mental connections needed for calculus to be accessible for me. So it is with abstract algebra — it is to programming what calculus is to modelling the real world.

*Digital Typography* – Donald E. Knuth

Ah, Knuth! Arguably the world’s most famous living computer scientist, Knuth is a programming household name thanks to *The Art of Computer Programming*, the complete volumes of which sit unread on many bookshelves. *Digital Typography* is an alternative offering composed of a series of essays relating various aspects of the development of TeX and Metafont. What comes across the most strongly for me while reading this is the astonishing attention to detail that Knuth brings to his works. Once you’re finished reading it, odds are you’ll have read one more Knuth book than most programmers!

*The Garbage Collection Handbook: The Art of Automatic Memory Management* – Richard Jones, Antony Hosking, Eliot Moss

This is the more modern descendant of *Garbage Collection* by Richard Jones and Rafael Lins. C++ has an aversion to garbage collection at the language level, but you might well find yourself implementing garbage collection or using a framework that has GC at some point in your career. After all, smart pointers are a form of garbage collection… that don’t handle loops and incur a potentially unbounded cost on a free. At any rate, this book is the bible of GC algorithms. It’s really interesting and useful for anyone concerned with handling memory — i.e., everyone who writes C++.

*Purely Functional Data Structures* – Chris Okasaki

Functional programming seems to be all the rage these days. Pick a random video from a random C++ conference and there’s an even chance it mentions some FP influence. This seminal book is almost 20 years old and still relevant as we C++-programmers tentatively explore the world of persistent data structures and immutability. It is the book form of Okasaki’s PhD thesis, so it’s quite rigorous, particularly with respect to cost and complexity analysis. It’s also a great read if you want to understand data structures in functional languages and come up with some ideas for your own implementations. The original PhD thesis is also available for free.

*Calendrical Calculations* – Edward M. Reingold & Nachum Dershowitz

This is a niche topic — and therefore an expensive outlay if you can’t apply it — but for those who are interested in date calculations, it’s both comprehensive and fascinating. The code given in the book is in Lisp and is not licensed for commercial use, but the authors also point out that their aim is simply to communicate the ideas and give you a starting point for your own implementation in your language of choice. If you’ve done any kind of CS or programming course, chances are you’ve written a function to determine leap years, so unlike Microsoft Excel, you know that 1900 was not a leap year. This book takes things so much further; when I say that it is comprehensive, I mean astonishingly so. Gregorian and Julian calendars are just the tip of the iceberg here, and the book covers almost everything else you could think of. Jewish and Chinese calendars? Of course. How about Mayan, or French Revolutionary, or a dozen other rules-based or astronomical calendars? If this whets your appetite, you may want to wait for the Ultimate Edition, currently due to be released at the end of March 2018. I wonder if Howard Hinnant is working his way through all these calendars while building his date library?

*About Face: The Essentials of Interaction Design* – Alan Cooper et al.

This is now up to its 4th edition; I read the 2nd. If you work on an application that has a user interface — and they all do — you should read this. If you work with designers, this will help you understand their processes and language. This book strikes the right balance between breadth and depth and covers a lot of ground. I found the chapter “Rethinking Files and Save” particularly thought-provoking.

*Hacker’s Delight* – Henry S. Warren

After a fairly high-level recommendation, this one gets straight to the really low-level fun stuff. This is the bit-twiddler’s almanac, a spiritual descendant of HAKMEM and a trove of two’s complement recreations. If you’ve ever been asked during interview how to count the number of set bits in a word, this is the book you want to reference. It has everything from popcount and power-of-2 boundaries to space-filling curves, error correction, and prime number generation. You should probably also look up HAKMEM (AI Memo 239), the original collection of bit manipulation hacks.

*Pearls of Functional Algorithm Design* – Richard Bird

You’ve probably seen the famous “C++ Seasoning” talk by Sean Parent — if you haven’t, please go watch it now. Perhaps you were motivated to read Stepanov or study algorithms as a result. The Stepanovian C++-centric view of algorithms is very much concerned with counting operations, performing manual strength reductions, and identifying intermediate calculations. This book offers an alternative way to design beautiful algorithms in a functional style using a comparatively top-down approach to express algorithmic ideas while making them fast through clean decomposition and subsequent fusion. I think it’s important to study and apply both camps of algorithm design. It is difficult to write beautiful code if you just “count the swaps” without an awareness of the mathematics behind it, but it is equally difficult to make code fast if you simply “express the mathematics” without any awareness of the operations.

*Taking Sudoku Seriously: The Math Behind the World’s Most Popular Pencil Puzzle* – Jason RosenHouse & Laura Taalman

Like the first recommendation, this isn’t a book that will be immediately applicable to your day job, unless perhaps you’re writing a sudoku mobile app — in which case, buy and read this immediately. But I’m recommending it anyway because I love recreational mathematics, and this book is fun and accessible without dumbing down the material. If you’ve played sudoku and ever thought about solving — or better, generating — the puzzle programmatically, odds are you’ll enjoy this book. Group theory, graph theory, and sudoku variations of every kind abound. As a bonus, it’s dedicated to Martin Gardner.

Any recommendation list is going to be wildly incomplete and subjective, and, of course, there are a lot of books I had to leave out from this one, but perhaps a Part Two will follow at some point in the future. Feel free to chime in if you agree, disagree, or have your own favourites.