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 - Java Tutorial
From the course: Java Design Patterns: Creational
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.