0

Potential error in Python code for Builder pattern

Ian Wu 4 роки тому оновлено anonymous 4 роки тому 0

Hi there, I wanted to clarify if the code for the Builder pattern in Python is correct.


The Director class should refer to self._builder rather than self.builder?


    def build_minimal_viable_product(self) -> None:
        self.builder.produce_part_a()

    def build_full_featured_product(self) -> None:
        self.builder.produce_part_a()
        self.builder.produce_part_b()
        self.builder.produce_part_c()