定義:將一個複雜物件的構建與該物件的表示(representations)分離,使得同樣的構建過程可以建立不同的表示。(P.S. 這裏的表示應該是指物件各個不同的參數。)
Abstract factory and factory patterns are designed for polymorphism. builder pattern is not. The builder pattern uses another object, a builder, that receives each initialization parameter step by step and then returns the resulting constructed object at once.
就像去餐廳點餐一樣,客人只要向服務生這個介面下要求就好,不必參與後面餐點的複雜「建造」過程。
Abstract factory and factory patterns are designed for polymorphism. builder pattern is not. The builder pattern uses another object, a builder, that receives each initialization parameter step by step and then returns the resulting constructed object at once.
就像去餐廳點餐一樣,客人只要向服務生這個介面下要求就好,不必參與後面餐點的複雜「建造」過程。