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

工厂方法哪里请老师答疑一下 #334

Closed
JinYanRu opened this issue Aug 25, 2022 · 0 comments
Closed

工厂方法哪里请老师答疑一下 #334

JinYanRu opened this issue Aug 25, 2022 · 0 comments

Comments

@JinYanRu
Copy link

这个不是工厂方法吧老师,我最近学设计模式比较糊涂,有不理解的地方,
工厂方法的关键不是对不同产品提供不同的工厂吗, 所以我感觉 CouponCommodityService 在工厂方法中的身份应该是 实例工厂吧,但是我看您吧 StoreFactory 作为工厂了,我对这一点比较迷糊,这样就偏向简单工厂了吧,抽象工厂还有一个特点是解决了简单工厂再增加产品时,需要修改工厂类的代码,违反开闭原则的问题,示例代码我感觉同样有这个问题, 初学者看到这里特别迷,希望老师能看帮我解惑,谢谢老师。

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

No branches or pull requests

1 participant