To get the most out of this book
You will need a modern C++ compiler capable of building C++20 or later code. Everything in this book uses standard C++ and will run on any computer. All output is text.
This book lets you build the code with whatever build system you are most comfortable using. The projects all have few files with simple folder structures. You can easily create a project in your code editor and follow along.
This book does not describe finished projects. Each project is a journey. The first chapter starts with an empty project and each subsequent chapter adds to the code already created in previous chapters. You’re encouraged to follow along.
Remember to study the process. This is more important than the actual code that each chapter explains. The TDD process is mentioned many times in this book. The first few chapters introduce you to TDD until there are enough features available in the testing library so that the testing library can be used to build another project. The second logging library project explores the TDD process in more depth and detail. Once the logging library is usable, then both the testing and logging libraries are used to build a simple service project. There is a pattern to the TDD process that repeats. Learning the TDD process through each of the projects will give you the most benefit.
Because the projects are built step by step, you can also benefit from the mistakes explained along the way. Sometimes, the designs will change, and you can benefit from the reasons for the changes as well as learn how to manage the changes.
When I say that you need a C++20 compiler, that’s a simplification. There are many different features of C++ that compiler vendors support in different versions of their compilers. A good rule to follow is to make sure that your compiler supports concepts in C++20. We use concepts in the final chapters of this book and if your compiler supports concepts, then you should have everything you need. A good link to read more is:
https://en.cppreference.com/w/cpp/compiler_support
When you visit the link, scroll down to the C++20 section and look for the row that identifies the concepts feature. At the time of writing, the following compilers should work:
- GCC version 10
- Clang version 10
- MSVC version 19.30
- Apple Clang version 12 (however, this compiler only has a partial implementation)
You’ll likely be able to use whatever version of the C++ Standard Library that comes with your compiler. However, another good rule that should work is to make sure that your Standard Library also supports concepts. At the time of writing, the following Standard Libraries should work:
- GCClibstdc++ version 10
- Clang libc++ version 13
- MSVC STL version 19.23
- Apple Clang version 13.1.6
If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.