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

head first 设计模式-0x06 #19

Open
ichengzi opened this issue Jun 14, 2020 · 0 comments
Open

head first 设计模式-0x06 #19

ichengzi opened this issue Jun 14, 2020 · 0 comments

Comments

@ichengzi
Copy link
Owner

ichengzi commented Jun 14, 2020

模板方法模式
在一个方法中定义一个算法的骨架,而将一些步骤延迟到子类中。模板方法使得子类可以在不改变算法结构的情况下,重新定义算法中的某些步骤。

迭代器模式
提供一种方法顺序访问一个聚合对象中的各个元素,而又不暴露其内部的表示。

好莱坞原则告诉我们,将决策权放在高层模块中,以便决定如何以及何时调用低层模块。
你将在真实世界代码中看到模版方法模式的许多变体,不要期待它们全都是一眼就可以被你认出来。
策略模式和模版方法模式都是封装算法,一个用组合,一个用继承。
工厂方法是模版方法的一种特殊版本。

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