0

Potential error in Python code for Builder pattern

Ian Wu 5 років тому оновлено anonymous 5 років тому 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()