What is the Difference between GOF and GRASP design patterns

吃可爱长大的小学妹 提交于 2019-12-12 08:01:45

问题


I am really confused about the difference between GOF and GRASP patterns? even both contribute to improved Object oriented practices


回答1:


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




回答2:


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

  • Abstraction
  • Encapsulation (Information Hiding)
  • Hierarchy (Inheritance, Aggregation)
  • Modularity (High Cohesion and Loosely Coupling)

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.

  1. SOLID Priciples
  2. GRASP Principles
  3. Law of Demeter-LoD
  4. and etc. (other single named principles like LoD)

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.



来源:https://stackoverflow.com/questions/4270912/what-is-the-difference-between-gof-and-grasp-design-patterns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!