November 2019
Beginner to intermediate
674 pages
15h
English
The factory method, as specified originally, is almost useless in current times. It is not very flexible and requires a complicated hierarchy of classes. Nowadays, we still use the general idea, providing a method that creates something, but we wrap it into modern concepts. Usually, we use some form of dependency injection. An example of such a modification can be found in the project ExampleDI. For more information on dependency injection, see Chapter 10, Singleton, Dependency Injection, Lazy Initialization, and Object Pool.
As I have mentioned before, the whole reason for the TSomething class is to specify an interface. We can therefore replace it with a pure interface ISomething as shown in the following ...
Read now
Unlock full access