Summary
That wraps up our twin chapters on the Factory Method and Abstract Factory patterns! These two patterns, although related, are not the same and shouldn’t be used interchangeably or smooshed together into a Frankenstein factory. Always pick the right tool for the job!
Remember, the Abstract Factory pattern lets us abstract the creation process of families of related products. These object families should always be related, but they can be dependent on or interact with each other, and we can always extend our factories with parameters and factories of factories if necessary. Picking which solution to use depends on scale, product hierarchies, and the relationships you may or may not need between your objects and object families.
In the next chapter, we’ll explore how the Builder pattern helps separate the creation of complex objects from their representations and gives us the power of customized assembly lines!