Generic Programming: Books, Articles, Links, and more
Information sources on generic programming are scattered. This page shall serve as a little guide, without aiming at comprehensiveness. In line with my professional interests, I strongly focus on C++-oriented information. Hints and constructive criticism are highly welcome!After introducing some overview websites, this page gives hints on selected publications (books, articles, tutorials) and conferences on generic programming, as well as another page on examples of generic libraries.
Overviews
There is a quite comprehensive Overview on generic programming on Wikipedia, comparing generic programming concepts in a number of different languages. In particular, besides C++, also the contribution of the functional language community is considered.
Douglas Gregor maintains www.generic-programming.org (state essentially of 2006). A focus is on his developments on c++ concepts, namely Concept C++ and its implementation in ConceptGCC and ConceptClang. Concepts permit to constrain and check C++ Template arguments, but are not (yet) part of Standard C++. The site contains a glossary for important terms.
David Musser, one of the pioneers of generic programming, has a page covering his work on GP (state of 2003, seems to be unmaintained after his emeritation).
Publications
Tutorials and Training
There are very few tutorials on generic programming as such. Of course, there are a number of introductions to (using) the STL, but little stuff on how to design your own generic components.
Doug Gregor has published an Introduction to generic programming describing the lifting process, using the same example as I do in my tutorial (a sum). He focusses on notions like concepts and models, while my emphasis is more on the pitfalls and design alternatives occuring while making an implementation generic.
Dave Abrahams has published on Boost an article on techniques for generic programming, which are used in boost libraries.
At this site, I've started a new tutorial, to learn generic programming from the ground up. It is intended to grow further — just return here from time to time, or send me an email if you are interested.
Books
There are not many books putting generic programming into the focus. One kind of books deals with the techniques of C++ template programming, another kind explains the usage of generic libraries (mostly the STL, but also boost libraries). Often, those books contain advise on developing your own generic components.-
Elements of Programming.
Decomposing programs into a system of algorithmic components.
Addison Wesley,
2009
This is one of the most GP-focused books available. Not only does the title allude to Euclid's Elements, also the style is rather formal and terse. "This is not an easy book", the blurb promises. The authors show how to parallel mathematical structures in software by developing appropriate concepts and generic implementations of algorithms. After presenting some foundational definitions and theorems (for instance on so-called regular types), they develop advanced concepts for iterators, trees, and mutable sequences. For this book, a study group was initiated by Sean Parent on C++Next, but seems to have been abandoned after chapter 5.
-
Modern C++ Design.
Generic Programming and Design Patterns Applied.
Addison Wesley,
2001
This book has popularized a number of techniques like policy-based design and typelists. As applications, Alexandrescu treats allocators, smart pointers, object factories and singletons with his typical humorous writing. There is an in-depth review by Francis Glassborow on the ACCU pages.
-
C++ Template Metaprogramming.
Concepts, Tools, and Techniques from Boost and Beyond.
Addison Wesley,
2004
The book deals with metaprogramming, a technique to execute computations at compile time. an approach necessary for advanced generic programming in C++. The authors explain different aspects using the MPL (Boost Metaprogramming Library), and offer a systematic view on the fragmented earlier approaches like traits, which they replace by the concepts of type maps.
-
C++ Templates.
The Complete Guide.
Addison Wesley,
2002
Everything one needs to know about C++ templates (until 2011, at least), from a technical point of view. The book starts where most C++ text books stop, and is indispensable for serious C++ template programming.
Forums, Newsgroups
The Newsgroup comp.lang.c++.mod often shows threads dealing with aspects of generic programming in C++.Articles
There are a number of scientific or technical articles on generic programming (or at least show the term in their title or keywords). The following is a short, subjective selection of what I consider the most important papers. This list is going to grow, but will stay very incomplete.
- The selected articles of Alexander Stepanov, on of the pioneers of generic programming, can be found at http://www.stepanovpapers.com.
-
What is generic programming?
In Proceedings of the First International Workshop of Library-Centric Software Design (LCSD '05).
An OOPSLA 2005 workshop. San Diego (California), USA; October 2005.
The article tries to find a general definition of generic programming. The authors compare the two main directions, that is, the Musser-Stepanov approach (used in the C++ community), an the polytypic / datatype generic programming approach from the functional programming community. Both can be linked to concepts of mathematical category theory. While the Musser-Stepanov-approach mostly works by evaluating functionals on type arguments, the polytypic approach exploits the recursive definition of datatypes typical for functional languages to process them in a generic way. The article can hardly be fully understood without some background in category theory and F-algebras.
-
A comparative study of language support for generic programming
Proceedings of the 18th annual ACM SIGPLAN conference on
Object-oriented programming, systems, languages, and applications (OOPSLA'03),
Pages 115-134. ACM
2003
The article compares mechanisms for generic programming in C++, Java, Generic C#, Eiffel, Haskell and ML.
Conferences
The annual ACM SIGPLAN Workshop on Generic Programming appears to be the only regular conference dedicated to generic programming, dealing with it from a rather academic point of view (dominated by the functional programming school).
Focused on C++, the annual C++Now (used to be BoostCon) offers the largest selection on generic programming topics.
Many earlier conferences have been singular events or have not been continued, for instance the 1998 Dagstuhl Seminar "Generic Programming" and the 2002 MPC 2002 and IFIP WG 2.1 Working Conference Generic Programming. There have been workshops of the series Library-centric Software Design in 2005 and 2006 during OOPSLA. Though not explicitly focused on generic programming, it was a major topic.