What is GRASP and its principles?

Harpreet Singh Kalsi
I am a dummy, enlighten me!
10 min readJan 3, 2024

--

GRASP stands for General Responsibility Assignment Software Patterns or Principles. It is a set of guidelines that help in designing object-oriented software. Among the nine principles of GRASP, five of them are related to the concepts of generalization, responsibility, association, specialization, and polymorphism. These concepts are fundamental to object-oriented design and help in achieving some of the main goals, such as modularity, reusability, extensibility, and testability. In this article, I will explain what these concepts are and what are the pros and cons of applying them in software design. It is part of my series — I am a dummy, enlighten me.

Generalization

Generalization is the process of extracting common features from different classes and creating a superclass that contains those features. The subclasses inherit the features from the superclass and can add their own specific features. Generalization helps in creating a hierarchy of classes that share some common characteristics and behaviors, but also have some differences. For example, a class Animal can be a superclass of classes Dog, Cat, and Bird, which are subclasses of Animal. All animals have some common features, such as name, age, and weight, but they also have some specific features, such as breed, color, and sound.

Pros

--

--

Harpreet Singh Kalsi
I am a dummy, enlighten me!

Software Engineering Leadership | Advisor | Product Management | Published Book Author | Writer | Dad