开发者

What is the Difference between GOF and GRASP design patterns

I am really confused about the difference between GOF and GRA开发者_Python百科SP patterns? even both contribute to improved Object oriented practices


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜