In this recipe, we will learn what the factory pattern is, how to implement it, and when to use it. This recipe is important, especially when unit testing as the factory pattern provides the ability to add seams (that is, intentional places in your code that provide opportunities for making changes) capable of changing what type of object another object allocates, including the ability to allocate fake objects for testing.
Learning the factory pattern
Getting ready
Before beginning, please ensure that all of the technical requirements are met, including installing Ubuntu 18.04 or higher and running the following in a Terminal window:
> sudo apt-get install build-essential git cmake
This will ensure your operating system...