In this video, discover a more complete example of the Builder pattern. Learn how interfaces can be used to handle more complex examples.
- [Instructor] In this section,…I will refactor the example application…to create a more complete builder pattern.…Currently, it uses a simple builder…to create bedroom objects.…The Architect class creates bedroom objects…by specifying the characteristics…of the bedrooms that are needed,…however, it would be useful if it was possible…to create different kinds of rooms,…such as kitchens, bathrooms and so on.…In the classic builder pattern,…the Builder class is actually an abstract interface.…In this example, there could be an interface…that defines methods for building rooms in general,…and there could be different concrete builders…for different types of rooms.…
This would be useful because building a bedroom…has some of the same requirements for building a kitchen,…but in some respects, is very different.…To achieve this, the first thing we need to do…is to create the abstract interface.…In NetBeans, it is easy to create an interface…from an existing class.…On the left of the screen, there is a menu called Projects.…
Released
8/29/2018- What are creational design patterns?
- Avoid complex constructors
- Implementing the Builder pattern
- Multithreading with the Singleton pattern
- Using the Prototype pattern
- Implementing a simple Factory Method pattern
- Making code more flexible with the Abstract Factory pattern
Share this video
Embed this video
Video: Implement a complete Builder pattern