EN: It makes sense to use the Builder pattern only when your products are quite complex and require extensive configuration. Unlike in other creational patterns, different concrete builders can produce unrelated products. In other words, results of various builders may not alwa
| 114 | |
| 115 | |
| 116 | class Product1(): |
| 117 | """ |
| 118 | EN: It makes sense to use the Builder pattern only when your products are |
| 119 | quite complex and require extensive configuration. |
| 120 | |
| 121 | Unlike in other creational patterns, different concrete builders can produce |
| 122 | unrelated products. In other words, results of various builders may not |
| 123 | always follow the same interface. |
| 124 | |
| 125 | RU: Имеет смысл использовать паттерн Строитель только тогда, когда ваши |
| 126 | продукты достаточно сложны и требуют обширной конфигурации. |
| 127 | |
| 128 | В отличие от других порождающих паттернов, различные конкретные строители |
| 129 | могут производить несвязанные продукты. Другими словами, результаты |
| 130 | различных строителей могут не всегда следовать одному и тому же интерфейсу. |
| 131 | """ |
| 132 | |
| 133 | def __init__(self) -> None: |
| 134 | self.parts = [] |
| 135 | |
| 136 | def add(self, part: Any) -> None: |
| 137 | self.parts.append(part) |
| 138 | |
| 139 | def list_parts(self) -> None: |
| 140 | print(f"Product parts: {', '.join(self.parts)}", end="") |
| 141 | |
| 142 | |
| 143 | class Director: |