API Design for C++, 1st Edition

API Design for C++, 1st Edition,Martin Reddy,ISBN9780123850034


Morgan Kaufmann




235 X 191

Practical techniques of API design that produce robust code for the long term

Print Book + eBook

USD 73.74
USD 122.90

Buy both together and save 40%

Print Book


In Stock

Estimated Delivery Time
USD 62.95

eBook Overview

VST format:

DRM Free included formats: EPub, Mobi, PDF

USD 59.95
Add to Cart

Key Features

  • The only book that teaches the strategies of C++ API development, including design, versioning, documentation, testing, scripting, and extensibility.
  • Extensive code examples illustrate each concept, with fully functional examples and working source code for experimentation available online.
  • Covers various API styles and patterns with a focus on practical and efficient designs for large-scale long-term projects.


API Design for C++ provides a comprehensive discussion of Application Programming Interface (API) development, from initial design through implementation, testing, documentation, release, versioning, maintenance, and deprecation. The book focuses on the issues of designing APIs for a single language (C++), which remains one of the most widely used programming languages for large software projects. The book also covers specialized API topics, such as creating scripting and plug-in APIs, with emphasis on API design. A discussion on testing strategies concentrates on automated API testing techniques rather than attempting to include end-user application testing techniques such as GUI testing, system testing, or manual testing. The book will be helpful to new programmers who understand the fundamentals of C++ and who want to advance their design skills, as well as senior engineers and software architects seeking to gain new expertise to complement their existing talents. Three specific groups of readers are targeted: practicing software engineers and architects, technical managers, and students and educators.


All software engineers developing C++ code to be used by other developers, whether via APIs, libraries, device drivers, or other reusable components.

Martin Reddy

Dr. Martin Reddy is the founder and CEO of the software consultancy firm Code Reddy Inc. He holds a Ph.D. in Computer Science and has over 15 years of experience in the software industry. During this time, he has written 3 software patents and has published over 40 professional articles and a book on 3D computer graphics. Dr. Reddy worked for 6 years at Pixar Animation Studios where he was lead engineer for the studio’s in-house animation system. This work involved the design and implementation of various APIs to support several Academy Award-winning and nominated films, such as "Finding Nemo", "The Incredibles", "Cars", "Ratatouille", and "Wall-E." Dr. Reddy currently works for Linden Lab on the Second Life Viewer, an online 3D virtual world that has been used by over 16 million users around the world. His work is currently focused on a radical redesign of the Second Life Viewer, putting in place a suite of robust APIs to enable extensibility and scriptability.

Affiliations and Expertise

CEO, Code Reddy

API Design for C++, 1st Edition



1. Introduction

What Are Application Programming Interfaces?

What's Different about API Design?

Why Should You Use APIs?

When Should You Avoid APIs?

API Examples

File Formats and Network Protocols

About This Book

2. Qualities

Model the Problem Domain

Hide Implementation Details

Minimally Complete

Easy to Use

Loosely Coupled

Stable, Documented, and Tested

3. Patterns

Pimpl Idiom


Factory Methods

API Wrapping Patterns

Observer Pattern

4. Design

A Case for Good Design

Gathering Functional Requirements

Creating Use Cases

Elements of API Design

Architecture Design

Class Design

Function Design

5. Styles

Flat C APIs

Object-Oriented C++ APIs

Template-Based APIs

Data-Driven APIs

6. C++ Usage


Constructors and Assignment

Const Correctness


Operator Overloading

Function Parameters

Avoid #define for Constants

Avoid Using Friends

Exporting Symbols

Coding Conventions

7. Performance

Pass Input Arguments by Const Reference

Minimize #include Dependencies

Declaring Constants

Initialization Lists

Memory Optimization

Don't Inline Until You Need To

Copy on Write

Iterating Over Elements

Performance Analysis

8. Versioning

Version Numbers

Software Branching Strategies

Life Cycle of an API

Levels of Compatibility

How to Maintain Backward Compatibility

API Reviews

9. Documentation

Reasons to Write Documentation

Types of Documentation

Documentation Usability

Using Doxygen

10. Testing

Reasons to Write Tests

Types of API Testing

Writing Good Tests

Writing Testable Code

Automated Testing Tools

11. Scripting

Adding Script Bindings

Script-Binding Technologies

Adding Python Bindings with Boost Python

Adding Ruby Bindings with SWIG

12. Extensibility

Extending via Plugins

Extending via Inheritance

Extending via Templates

Appendix A: Libraries

Static versus Dynamic Libraries

Libraries on Windows

Libraries on Linux

Libraries on Mac OS X



Quotes and reviews

Martin Reddy draws from his experience on large scale, collaborative software projects to present patterns and practices that provide real value to individual developers as well as organizations. API Design for C++ explores often overlooked issues, both technical and non- technical, contributing to successful design decisions that produce high quality, robust, and long-lived APIs. - Eric Gregory, Software Architect, Pixar Animation Studios

"Intended for programmers with intermediate to advanced skills in the C++ programming language, this guide to the building of useful and robust application programming interfaces (APIs) provides practical instruction for software engineers developing systems on which downstream software engineers depend. The work provides a methodical approach to API design covering solution based API design, performance, versioning, documentation, testing, scripting, extensibility and libraries. The work includes numerous illustrations and code examples and access to additional online resources is provided. Reddy is a software development consultant."--Book News, Reference & Research


Shop with Confidence

Free Shipping around the world
▪ Broad range of products
▪ 30 days return policy

Contact Us