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()

UserEcho 的客户支持