Skip to content.
Main > TWikiUsers > CraigSchwartz > GraspSoftwareArchitecturePatterns

General Responsibility Assignment Software Patterns (GRASP)

Expert

Who, in the general case, is responsible ?

Assign a responsibility to the information expert - the class that has the information necessary to fulfill the responsibility.

Creator

Who Creates ?

Assign class B the responsibility to create an instance of class A if one of the following is true:

  1. ) B contains A
  2. ) B aggregates A
  3. ) B has the initializing data for A
  4. ) B records A
  5. ) B closely uses A

Controller

Who handles a system event ?

Assign the responsibility for handling a system event message to a class representing one of these choices:

  1. ) The busines or overall organization (a facade controller)
  2. ) The overall "system" (a facade cont4roller).
  3. ) An animate thing in the domain that woudl perform the work (a role controller)
  4. ) An artifical class (Pure Fabrication) representing the use case (a use case controller).

Low Coupling

How to support low dependency and increased reuse ?

Assign responsibilities so that coupling remains low.

High Cohesion

How to keep complexity manageable ?

Assign responsibilities so that cohesion remains high.

Polymorphism

Wo, when behavior varies by type ?

When related alternatives or behaviors vary by type(class), assign responsibility for the behavior - using polymorphic operations - to the types for which the behavior varies.