Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

ACM SIGSOFT Software Engineering Notes Page 50 September 2011 Volume 36 Number 5

API design for C++


Martin Reddy
DOI: 10.1145/2020976.2021002
http://doi.acm.org/10.1145/2020976.2021002

API design for C++ is written by Martin Reddy, and published by


Morgan Kaufmann © 2011 Elsevier, Inc., paperback, ISBN 978-0-
12-385003-4, 441 pp., $43.36 at Amazon.com.
This book covers API design in depth, with a keen focus on
fundamental quality concerns. I highly recommend the text to
both beginners and seasoned API designers as a reference and
guide. The target audience is broad: practicing software engineers
and architects, technical managers, students and educators. This
text could be useful for the beginning programmer, but I would not
recommend it as a first study on coding. The writing style has an
easygoing, logical flow and is clearly understandable. Even
though the code samples are C/C++ and the book specifically
covers C++ APIs, applying the key concepts presented will
improve the design of any API no matter what programming
language is used.
The book website provides code samples that are built using
CMake and can be run on Windows, Mac OS X and UNIX
systems. I was able to use CMake to build the code samples into
MS Visual Studio 2010 projects without any problem. The coding
examples are useful and intuitive.
The first four chapters deal with creating good API design.
Chapter 5 presents an interesting analysis of the design,
advantages, and disadvantages of four styles of API. These
include Flat C with no objects or inheritance, Object Oriented C++
utilizing concepts of inheritance, encapsulation and polymorphism,
Template-based generic APIs that will be instantiated later with
concrete types, and a Data-driven type API. Following chapters
cover C++ usage specifics, performance concerns, performance
analysis, and how to put in place a comprehensive versioning
system. Chapters 9 and 10 describe the very important quality
concerns of providing excellent supporting documentation and
complete testing of your API, including automated testing. The
author helpfully provides links to open source documentation tools
and outlines the key documentation that should be provided to
make use of your API easy to implement, understand and learn
more about. Every aspect of testing, including test-driven
development and automated testing are discussed in enough detail
to enable the reader to incorporate these into their own APIs.
Advanced topics of script binding and API extensibility via
plugins, inheritance, or templates are covered in the remaining two
chapters. The Appendix provides a complete education about
software libraries – static and dynamic on Windows, Linux and
MAC OS X.
I found this to be an exceptional textbook, one I will keep in my
reference library. I am now prepared to produce my own reusable
C++ API. Searching Amazon turned up very few books on API
design, and those are mostly over five years old. There is one
JAVA API book available, published in 2008. Martin Reddy’s
book covers much more in the area of incorporating current quality
control methods simultaneously with coding development
activities than the Java book does. Be sure to check API design for
C++ for your next API Project.
Reviewed by Leslie Glaves, Lockheed Martin IS&GS,
leslie.glaves@lmco.com.

You might also like