Chapter 14. Henney’s Hypothesis, or When Templates Attack!

 

Inconsistency imposes mental friction into a developer’s work.

 
 --Scott Meyers

Writing good template libraries in C++ is a delicate balance between exercising the considerable power afforded by template programming and making overly complex and undiscoverable interfaces that confound users. Kevlin Henney has suggested a relationship that captures the essence of this balance, which I call Henney’s Hypothesis.

Henney’s Hypothesis

For each additional [required] template parameter, the potential number of users is halved.

The “[required]” part is my own humble addition to the hypothesis. I think this is an important modification since it’s the number of template parameters a user is required ...

Get Extended STL, Volume 1: Collections and Iterators now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.