REVIEW - API Design for C++


API Design for C++


Martin Reddy


Morgan Kaufmann Pub (2011)




Alan Lenton


April 2014



Reviewed: May 2013

Martin Reddy has written a very useful book on the art and science of Application Programming Interfaces (APIs), and along the way has produced a book chock full of useful hints and help for more junior programmers. It is not a book for someone wanting to learn to program in C++, but if you have been programming in C++ for a year or so, then you will find this book will help you move toward towards program design instead of just ‘coding’.

Obviously, the book concentrates on API design, but along the way it covers selected patterns, API styles, performance, testing and documentation. As a bonus it also covers scripting and extensibility, and I found the section on plugins particularly useful. An appendix covers the varied technical issues involved in building both static and dynamic libraries on Windows Mac and Linux.

The only minor disagreement I would have with the author is with the extent to which he goes to move internal details out of header files in the name of preventing the API users from doing anything that might allow them to access those features. From my point of view, using the API is a type of contract between the API writer and the API user. If the user is foolish enough to break that contract then he or she has to take the consequences in terms of broken code when a new version of the library comes out. In any case this sort of behaviour should be picked up by code review in any halfway decent software studio.

That is, however, a minor niggle, and this book represents a rich seam for programmers to mine for good programming practices – even if you aren’t writing API, your use of them will improve dramatically!

Book cover image courtesy of Open Library.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.