
API Design for C++
- 2nd Edition - May 23, 2024
- Imprint: Morgan Kaufmann
- Author: Martin Reddy
- Language: English
- Paperback ISBN:9 7 8 - 0 - 4 4 3 - 2 2 2 1 9 - 1
- eBook ISBN:9 7 8 - 0 - 4 4 3 - 2 2 2 2 0 - 7
API Design for C++, Second Edition provides a comprehensive discussion of Application Programming Interface (API) development, from initial design through implementation, testing,… Read more

Purchase options

Institutional subscription on ScienceDirect
Request a sales quoteAPI Design for C++, Second Edition provides a comprehensive discussion of Application Programming Interface (API) development, from initial design through implementation, testing, documentation, release, versioning, maintenance, and deprecation. It is the only book that teaches the strategies of C++ API development, including interface design, versioning, scripting, and plug-in extensibility. Drawing from the author's experience on large scale, collaborative software projects, the text offers practical techniques of API design that produce robust code for the long-term. It presents patterns and practices that provide real value to individual developers as well as organizations.
The Second Edition includes all new material fully updated for the latest versions of C++, including a new chapter on concurrency and multithreading, as well as a new chapter discussing how Objective C++ and C++ code can co-exist and how a C++ API can be accessed from Swift programs. In addition, it explores often overlooked issues, both technical and non-technical, contributing to successful design decisions that produce high quality, robust, and long-lived APIs. It focuses on various API styles and patterns that will allow you to produce elegant and durable libraries. 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.
- Teaches the strategies of C++ API development, including design, versioning, documentation, testing, scripting, and extensibility
- Includes extensive code examples that 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
- Includes updated URLs and ensures all code examples continue to work with modern compilers and supporting tools
- Cover image
- Title page
- Table of Contents
- Copyright
- Author biography
- Foreword
- Preface
- Acknowledgments
- 1. Introduction
- What are APIs?
- What's different about API design?
- Why should you use APIs?
- When should you avoid APIs?
- API examples
- Libraries, frameworks, and software development kits
- 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
- Singleton
- 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
- Functional APIs
- Data-driven APIs
- 6. C++ usage
- Namespaces
- Constructors and assignment
- Const correctness
- Templates
- Operator overloading
- Function parameters
- Avoid #define for constants
- Avoid using friends
- Exporting symbols
- Coding conventions
- 7. C++ revisions
- Which C++ revision to use
- C++11 API features
- C++14 API features
- C++17 API features
- C++20 API features
- C++23 API features
- 8. Performance
- Pass input arguments by const reference
- Minimize #include dependencies
- Declaring constants
- Initialization lists
- Memory optimization
- Don't inline functions until you need to
- Copy on write
- Iterating over elements
- Performance analysis
- 9. Concurrency
- Multithreading with C++
- Terminology
- Accessing shared data
- Concurrent API design
- 10. Versioning
- Version numbers
- Software branching strategies
- Life cycle of an API
- Levels of compatibility
- How to maintain backward compatibility
- API reviews
- 11. Documentation
- Reasons to write documentation
- Types of documentation
- Documentation usability
- Using Doxygen
- 12. Testing
- Reasons to write tests
- Types of API testing
- Writing good tests
- Writing testable code
- Automated testing tools
- 13. Objective-C and Swift
- Interface design in C++ and Objective-C
- Data hiding in Objective-C
- Objective-C behind a C++ API
- C++ behind an Objective-C API
- C++ behind a Swift API
- 14. Scripting
- Adding script bindings
- Script binding technologies
- Adding Python bindings with Boost Python
- Adding Ruby bindings with SWIG
- 15. Extensibility
- Extending via plugins
- Extending via inheritance
- Extending via templates
- Appendix A: Libraries
- References
- Index
- Edition: 2
- Published: May 23, 2024
- Imprint: Morgan Kaufmann
- No. of pages: 648
- Language: English
- Paperback ISBN: 9780443222191
- eBook ISBN: 9780443222207
MR
Martin Reddy
Dr. Martin Reddy holds a Ph.D. in Computer Science and has over 30 years of experience in the software industry. He is a Fellow of the IEEE, a Fellow of the AAIA, and a Distinguished Member of the ACM. He has published 10 patents, over 40 professional articles, and 2 books. Martin was co-founder and CTO of the AI startup, PullString, where he oversaw the development of the company's technology until it was acquired by Apple in 2019. While at Apple, Martin was a software architect responsible for the architecture and APIs of major components of the Siri virtual assistant. Before that, Dr. Reddy worked for 6 years at Pixar Animation Studios where he was a lead engineer for the studio's in-house animation system. He worked on several Academy Award Winning and Nominated films, such as "Finding Nemo", "The Incredibles", "Cars", "Ratatouille", and "Wall-E". He was also the hair model for Mr Incredible. Martin began his career at SRI International where he worked on a distributed 3D terrain visualization system and co-authored the geospatial functionality in the VRML and X3D ISO standards. Martin was awarded Alumnus of the Year by his alma mater, Strathclyde University.