Factory patterns: avoiding the “new” keyword to satisfy the DIP

The man who builds a factory builds a temple -- Calvin Coolidge (1872-1933)
The man who builds a factory builds a temple — Calvin Coolidge (1872-1933)

Every line of code that uses the new keyword violates the Dependency Inversion Principle (DIP). Indeed, a class after new must be always concrete:

Continue reading “Factory patterns: avoiding the “new” keyword to satisfy the DIP”

Advertisements