GOF 和 GRASP 设计模式有什么区别
我真的很困惑 GOF 和 GRASP 模式之间的区别? 甚至两者都有助于改进面向对象的实践
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我真的很困惑 GOF 和 GRASP 模式之间的区别? 甚至两者都有助于改进面向对象的实践
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
简短回答:
GoF提到了设计模式。而GRASP是设计原则。设计原则比设计模式更抽象。
长答案:
软件工程的主要目的是开发合适的软件。 SDLC 呈现了顶层软件工程的步骤。 软件设计是 SLDC 步骤之一。而面向对象的软件设计是一种流行的软件设计方法。
要执行面向对象的软件设计,有多种不同名称的资源(书籍、教程和论文),例如:指南、原则、启发式、模式、样式等。
之间的差异这些名称是它们的抽象。顶层是主要原则,其他级别是有助于实现这些主要原则的细节。
顶层
在顶层,教程介绍主要原则。 (基于面向对象的分析和应用程序设计,Grady Booch 等人,1991 年)
面向对象的主要原则
后续的所有原则和模式都与这个主要原则相关,并试图支持和改进它们。
第二级
在第二级资源中,有原则,并试图支持和改进面向对象的主要原则。
第三级
此级别的资源称为设计模式。 Gof(四人帮)有第一本关于设计模式的书。有 23 种设计模式支持面向对象设计的主要原则和其他原则。
GoF之后,出现了许多关于在特定编程语言和特定框架中使用设计模式的书籍(例如J2EE设计模式、JQuery设计模式等)。
设计模式更加详细,并且非常接近编程语言。然而,主要原则(顶层)和原则(第二层)是如此抽象。
第四级
在这一级中,资源称为:启发式。
这个级别的资源比其他组更详细、更具体。
最好的资源是Object Oriented Design Heuristics(72 Heuristics),Arthur J. Riel 的书,1996
Fifth Level
在最后一级,有Guideline。
书中所有的做、不要做、避免……指南都可以集中在这个组中。
Short Answer:
GoF are mentioned to Design Patterns. And GRASP are Design Principles. Design Principles are so abstract than Design Patterns.
Long Answer:
The main purpose of Software Engineering is developing a proper software. SDLC presents the steps of Software Engineering in top level. Software Design is one of SLDC steps. And Object Oriented Software Design is a popular approach of Software Design.
To perform an Object Oriented Software Design, there are many kind of resources (in Books, Tutorials and Papers) with different names such as: Guidelines, Principles, Heuristics, Patterns, Styles and etc.
The differences between these names are the Abstraction of them. Top Level is the main principles and other levels are details that help to reach these main principles.
Top Level
At the top level, tutorials present Main Principles. (based on Object-Oriented Analysis and Design with Applications, Grady Booch, et al. 1991)
Object Oriented Main Principles
All subsequent principles and patterns is related to this main principles and try to support and improve them.
Second Level
In the second level of resource there are Principles and trying to support and improve Main Principles of Object Orientation.
Third Level
This level of resources called Design Patters. Gof (Gang of Four) have the first book about Design Patterns. There is 23 Design Patterns to support main principles and other principles of Object Oriented Design.
After GoF, many books written about using Design Patterns in specific programming language and specific frameworks (e.g. J2EE Deign Patterns, JQuery Design Patterns and etc.)
Design Patterns are more detailed and so close to programming language. However, Main Principles (at Top Level) and Principles (at Second Level) is so abstract.
Forth Level
In this level, resources called : Heuristics.
The resource of this level are so detailed and very specific than other groups.
The best resource is Object Oriented Design Heuristics (72 Heuristics) , Book by Arthur J. Riel, 1996
Fifth Level
At the final level, there are Guideline.
All Do It, Don't Do it, Avoid, ... guidelines in the books can be gather in this group.
GOF 是模式,即针对重复出现的问题的经过验证的设计解决方案。 把握是原则和不依赖于任何特定的问题领域,因此在任何情况下都是如此
GOF are patterns i.e. proven design solutions to recurring problems. GRASP are principles and are not tied to any specific problem domain hence true in any scenario