From the course: Java Design Patterns: Creational

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Understand the Abstract Factory pattern

Understand the Abstract Factory pattern - Java Tutorial

From the course: Java Design Patterns: Creational

Start my 1-month free trial

Understand the Abstract Factory pattern

- [Instructor] The Abstract Factory Pattern provides an interface for creating families of objects without specifying what their concrete types are. It should be used when there is a system that creates objects, but how those objects are created should be hidden from view. In particular, it is used when applications have families of objects. The application should be able to choose which of a selection of families it wants to use. The abstract factory pattern can ensure that family groups are used together. Say, for example, there is an application that builds bicycles. First, all of the individual bike parts need to be built. The wheels, handlebars, gear and frame, and so on, need to be made, and not just any old parts. To make a mountain bike, for example, you need wheels with a strong frame and thick tires. Mountain bikes also need straight handlebars, so these different parts are examples of a family of objects that need to be made together. The process of making a mountain bike…

Contents