战略设计模式与国家设计模式有何区别? [英] What is the difference between Strategy design pattern and State design pattern?
问题描述
c 我正在网路上浏览不少文章,但无法明确区分。 有人可以用外行人的说法解释吗? 老实说,这两种模式在实践中非常相似,而且它们之间的定义差异往往会随着你的问题而变化。一些流行的选择是: 经典实现将匹配状态或策略中的每个项目,列表中,但是您可以跨越具有两者混合的混合动力。一个特定的一个是更多的状态或战略y最终是一个主观问题。 What are the differences between I was going through quite a few articles on the web but could not make out the difference clearly. Can someone please explain in layman's terms? Honestly, the two patterns are pretty similar in practice, and the defining difference between them tends to vary depending on who you ask. Some popular choices are: A "classic" implementation would match either State or Strategy for every item on the list, but you do run across hybrids that have mixes of both. Whether a particular one is more State-y or Strategy-y is ultimately a subjective question. 这篇关于战略设计模式与国家设计模式有何区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
Strategy
design pattern and State
design pattern?