Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Difference between GOF and GRASP design patterns

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

like image 811
Afnan Bashir Avatar asked Nov 24 '10 19:11

Afnan Bashir


People also ask

What does GoF stand for in design patterns?

What is GoF in design patterns? GoF is actually a commonly used acronym that stand for Gang of Four. The Gang of Four refers to the four authors of the popular book on design patterns called “Design Patterns: Elements of Reusable Object-Oriented Software”.

What is the purpose of grasp patterns?

GRASP (General Responsibility Assignment Software Patterns) is a design pattern in object-oriented software development used to assign responsibilities for different modules of code.

Is GoF design patterns still relevant?

Since its release in 1994, the Design Patterns book continues to be a seminal work in building software. The book created a new shared vocabulary and named these repeated solutions we see all over different codebases.


2 Answers

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.

like image 117
Gholamali-Irani Avatar answered Sep 21 '22 09:09

Gholamali-Irani


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

like image 39
Aravind Yarram Avatar answered Sep 23 '22 09:09

Aravind Yarram