Another factory pattern helps you deal with variations on objects that you need to create. This video walks through how the factory method pattern works.
- [Instructor] We just used a simple factory … to create our pizza store. … Notice that the Simple factory allows us to decouple … the process of creating objects … from the clients that use those objects. … In our case, we used a simple factory … to create pizzas so that the pizza store … didn't have to worry about the details … of the various pizza types. … Instead it could focus … on the pizza preparation and delivery. … This approach works well. … But what happens if we have multiple store franchises? … Let's say we have two pizza stores … and one wants to make New York-style pizza … and the other one wants to make Chicago-style pizza. … Now we're in the situation … where we're going to need to use two different factories … to make two different styles of pizza. … We know the downside of that, code duplication. … It's also presumably our process. … That is all that code that isn't changing … that has made it successful … and we want to keep that common to both stores … while giving the stores the flexibility …
- What are design patterns?
- Encapsulating code that varies with the Strategy pattern
- The limitations of inheritance
- Using the Adapter pattern
- Implementing the Observer pattern
- Extending behavior with composition and the Decorator pattern
- Encapsulating iteration with the Iterator pattern
- Object creation with the Factory Method pattern
- Using design principles to guide your object-oriented design
Skill Level Intermediate
1. Design Patterns
2. The Strategy Pattern
3. The Adapter Pattern
4. The Observer Pattern
Using the Observer pattern2m 23s
5. The Decorator Pattern
6. The Iterator Pattern
7. The Factory Patterns
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.