Modern C++ API Design [2019 Class Archive]

“Modern C++ API Design” is a two-day training course with programming examples taught by Bob Steagall. It is offered at the Gaylord Rockies from 9AM to 5PM on Saturday and Sunday, September 14th and 15th, 2019 (immediately prior to the conference). Lunch is included.

Course Description

Let’s face it: writing an elegant, reusable C++ API can be a daunting task. There’s an overwhelming amount of instructional material that describes how to use individual language and library features, but not nearly as much explaining how to craft effective interfaces. You recognize that APIs are a critical aspect of your code, and you’d like to provide your users with a great experience, but how?

Interface Design for Modern C++ will provide practical tips and guidance for achieving this goal. This course is designed for advanced beginners to intermediate-level C++ programmers who have a basic grasp of language and library fundamentals, and now want take their skills to the next level and create  interfaces for others.

We’ll learn about desirable API characteristics to pursue, and common mistakes to avoid. We’ll study which language features to use, and how to use them, in order to create C++ interfaces that are elegant, easy to learn, robust, and reusable. Along the way we’ll review examples of a few good and not-so-good interfaces, and practice designing some APIs of our own.

Join us for two days of stepping back from the language feature trees and thinking about the API forest!

Prerequisites

Participants should have advanced beginner to intermediate knowledge of C++14 and the standard library, including a basic understanding of copy semantics, move semantics, inheritance, virtual functions, exceptions, lambdas, and some experience with templates.  Experience with multi-threading is a plus, but not required.

There will be several API development exercises, so participants should bring a laptop with their favorite C++ IDE or editor, as well as a C++14 or C++17 compiler.

Course Topics

  • The business case for a well-designed API
  • Characterizing a good API
  • Recognizing a bad API
  • A taxonomy of API styles
  • A process for API design
  • Key C++ idioms and patterns to know, and anti-patterns to avoid
  • Choosing the right C++ language and library features for your API
  • Run-time and compile-time polymorphism
  • Type Design
  • Library Design
  • Designing for extensibility
  • Performance considerations
  • Versioning considerations
  • Documentation and testing bad practices
  • Deliverables and release models
  • Case studies of good, bad, and ugly C++ APIs
  • API design exercises

Course Instructor

Bob Steagall

Bob Steagall has been working in C++ since discovering the second edition of The C++ Programming Language in a college bookstore in 1992. The majority of his career has been spent in medical imaging, where he led teams building applications for functional MRI and CT-based cardiac visualization. After a brief detour through the worlds of DNS and analytics, he’s now working in the area of distributed stream processing. He is a voting member of the C++ Standardization Committee, and has a blog where he occasionally writes about C++ and related topics. Bob holds BS and MS degrees in Physics, is an avid cyclist when weather permits, and lives in fear of his wife’s cats.