Skip to content
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

创建型模式的总结 #8

Open
hujianglang opened this issue Oct 16, 2021 · 0 comments
Open

创建型模式的总结 #8

hujianglang opened this issue Oct 16, 2021 · 0 comments

Comments

@hujianglang
Copy link
Owner

  1. Singleton模式解决的是实体对象个数的问题。除了Singleton之外,其他创建型模式解决的都是new所带来的
    耦合关系;

  2. Factory Method, Abstract Factory ,Builder都需要一个额外的工厂类来负责实例化,易变对象,而
    Prototype则是通过原型(一个特殊的工厂类)类克隆易变对象。

  3. 如果遇到易变对象,起初的设计通常从Factory Method开始,当遇到更多的复杂变化时,再考虑重构为其他的
    三种工厂模式(Abastract Factory , Builder, prototype).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant