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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.