Builder : Design Patterns In Python

Published: 07 March 2021
on channel: SBCODE
6,975
76

Medium Article :   / builder-design-pattern-in-python  

Documentation : https://sbcode.net/python/builder/

The Builder Pattern is a creational pattern whose intent is to separate the construction of a complex object from its representation so that you can use the same construction process to create different representations.

The Builder Pattern tries to solve,

How can a class create different representations of a complex object?
How can a class that includes creating a complex object be simplified?
The Builder and Factory patterns are very similar in the fact they both instantiate new objects at runtime. The difference is when the process of creating the object is more complex, so rather than the Factory returning a new instance of ObjectA, it calls the builders director constructor method ObjectA.construct() that goes through a more complex construction process involving several steps. Both return an Object/Product.

(Book) Sometimes you just want to switch off your computer and read from a book. So, all GoF patterns are discussed in my Design Patterns In Python book
https://www.amazon.com/dp/B08XLJ8Z2J : ASIN B08XLJ8Z2J
https://www.amazon.com/dp/B08Z282SBC : ASIN B08Z282SBC

#builder
#builderPattern
#designPatterns
#pythonDesignPatterns