-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
精读《设计模式 - Builder 生成器》 #273
Comments
挖个坟,最近才又有时间看了,按照示例里的代码的话,那么如果我要再增加一个concreatebuilder, 我们就得同时修改director 和 添加一个新的concreatebuilder嘛,不知道是否我理解有误。
}, class CabinBuilder { public buildB() { public build() { |
新增一个 Builder 一般不用新增 Director: const director = new Director();
const houseBuilder = new HouseBuilder();
const house = director.create(houseBuilder);
const carBuilder = new CarBuilder();
const car = director.create(carBuilder); |
|
设计模式属于能看懂,又很容易忘记的知识,为了方便设计模式应用于日常项目中,精读会增加一些配图解释,希望在读完设计模式后,以后再次翻阅文章时,通过图就可以快速回忆起内容。
上次的抽象工厂我们举了三个例子:汽车工厂、迷宫游戏、事件联动,我觉得这种例子也很利于理解枯燥的设计模式,后面的文章都会用类似的手法书写。
精读《设计模式 - Builder 生成器》
The text was updated successfully, but these errors were encountered: