Session 12 of Software Lessons, “Programming in Python: Object-Oriented (OOP) Part 4 (Builder Pattern),” runs about 24 minutes.
What this session covers
- The builder design pattern
Key ideas
- The builder pattern is a creational pattern that constructs a complex object step by step instead of in one large constructor call.
- A builder collects the settings for an object and produces the finished object at the end.
- Builders are useful when an object has many optional parts, because the steps read clearly and can be reordered or skipped.
- A builder can delegate to a factory for the parts it needs, so the two patterns can work together.