GRASP (object-oriented design)

General Responsibility Assignment Software Patterns (or Principles), abbreviated GRASP, is a set of "nine fundamental principles in object design and responsibility assignment"[1]: 6  first published by Craig Larman in his 1997[citation needed] book Applying UML and Patterns.

The different patterns and principles used in GRASP are controller, creator, indirection, information expert, low coupling, high cohesion, polymorphism, protected variations, and pure fabrication.

These techniques have not been invented to create new ways of working, but to better document and standardize old, tried-and-tested programming principles in object-oriented design.

"[3]: 272  Thus, the GRASP principles are really a mental toolset, a learning aid to help in the design of object-oriented software.

[3]: 17:11 Related Pattern or Principle: Low Coupling, High Cohesion The creation of objects is one of the most common activities in an object-oriented system.

An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the model-view-controller pattern.

Solution: Assign the responsibility to an intermediate object to mediate between other components or services so that they are not directly coupled.

Alternatively, low cohesion is a situation in which a set of elements, of e.g., a subsystem, has too many unrelated responsibilities.

Subsystems with low cohesion between their constituent elements often suffer from being hard to comprehend, reuse, maintain and change as a whole.

Solution: Identify points of predicted variation or instability; assign responsibilities to create a stable interface around them.

A pure fabrication is a class that does not represent a concept in the problem domain, specially made up to achieve low coupling, high cohesion, and the reuse potential thereof derived (when a solution presented by the information expert pattern does not).