Chapter 11. Factories

I can’t abide ugliness in factories! In we go, then! But do be careful, my dear children! Don’t lose your heads! Don’t get overexcited! Keep very calm!

—Willy Wonka

Of all the patterns used in DDD, Factory is probably one of the better known. Highly publicized in Design Patterns [Gamma et al.] are Abstract Factory, Factory Method, and Builder. I won’t in any way attempt to overshadow the advice given there, or that provided by [Evans]. The focus here is to provide examples of how you can use Factories in the domain model.

Get Implementing Domain-Driven Design 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.