Chapter 4. Designing with Libraries and Patterns
Experienced C++ programmers never start a project from scratch. They incorporate code from a wide variety of sources, such as the standard template library, open-source libraries, proprietary code bases in their workplace, and their own code from previous projects. In addition, good C++ programmers reuse approaches or strategies to address various common design issues. These strategies can range from a technique that worked for a past project to a formal design pattern. This chapter explains how to take into account existing code and strategies when designing your programs.
Chapter 2 introduced the theme of reuse, explaining that it can apply both to code reuse and to idea reuse. This chapter expands on that theme by giving specific details and strategies that you can use in your program designs. After finishing this chapter, you will understand:
The different types of code available for reuse
The advantages and disadvantages of code reuse
General strategies and guidelines for reusing code
Open-source libraries
The C++ standard library
Design techniques and patterns
Reusing Code
You should reuse code liberally in your designs. In order to make the most of this rule, you need to understand the types of code that you can reuse and the tradeoffs involved in code reuse.
A Note on Terminology
Before analyzing the advantages and disadvantages of code reuse, it is helpful to specify the terminology involved and to categorize the types of reused code. ...
Get Professional C++ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.