Read the description of other patterns.
GRASP (General Responsibility Assignment Software Patterns) - design patterns used to solve common tasks of assigning duties to classes and objects.
There are nine known GRAPS templates, originally described in the book by
Craig Larman “Application of UML and Design Patterns”. Unlike the patterns familiar to the reader from the Gang of Four, the GRAPS patterns do not have a pronounced structure, a clear scope and a specific problem to be solved, but merely represent generalized approaches / recommendations / principles used in the design of a system design.
')
Consider the characteristics of the basic GRASP patterns.
Subject area
For a more detailed understanding by the GRASP reader of templates, examples of their use from the subject area of ​​maritime transportation will be described.
Shipping company Navigator + is the largest provider of maritime freight services. The head office of the company consists of three departments: the customer service department, the flight dispatch department, the flight configuration department. Managers from the customer service department draw up contracts for the delivery of cargo from point A to point B. Dispatchers from the flight control department monitor the position of ships. Administrators from the flight picking department form cargo flights on the basis of contracts with customers.
Information Expert
The information expert pattern is the basic and at the same time the most obvious of the nine. The information expert describes the fundamental principles for assigning duties to classes and objects. According to the description, an information expert (an object endowed with certain duties) is an object possessing the maximum information necessary for the performance of assigned duties.
As an example, consider the calculation of the total amount of cargo and its cost on a particular flight, and generalized for all flights of the company.

The use of the information expert pattern increases the connectivity of the modules and does not contradict the encapsulation property.
Low Coupling and High Cohesion
Perhaps in any literature on object-oriented design, these two concepts are encountered. It is believed that any designed system must meet the principles of low connectivity and high engagement of modules. Compliance with these templates allows you to easily modify and maintain the program code and also increases the degree of its reuse.
Consider the concept of a measure of connectedness of modules and a measure of the linking of a module. A measure of the connectivity of modules is determined by the amount of information that one module has about the nature of another. In turn, the measure of the engagement of the module is determined by the degree of focus of its duties.
It is worth noting that there are methodologies according to which measures of connectedness and linking can be assessed on a scale from 1 to 10 for a specific case. However, in the framework of this article they are not considered.
An example of a good system design is the GNU Binutils toolkit for Linux. In which, each utility (if treated as a module) performs only minimal duties (high gearing) and knows almost nothing about the nature of other utilities (low connectivity), and therefore can be easily replaced with an analogue in some use case.
Resistant to change (Protected Variantions)
The problem of system modification is most relevant in the context of dynamically changing requirements. Often, it is possible to identify the so-called system instability points that are most often subject to change / modification. Then, the essence of the template is resistant to change is to eliminate the points of instability, by defining them as interfaces and implementing different behaviors for them.
For example, consider the situation of the expansion of Navigator + services. We assume that the shipping company began to engage in passenger transportation. To do this, we implement the point of stability of the system - the entity being transported (Entity).

Controller (Controller)
The controller is responsible for handling input system events, delegating responsibilities for handling the relevant classes. In general, the controller implements one or more
use cases.
The concept of an external controller (Front Controller), which represents the entire system as a whole (aggregates all the functionality of the system in one class), is well known.
An example of a controller is the Administrator class, which implements the use of the system by the administrator from the flight configuration department.

The use of controllers allows you to separate the logic from the presentation, thereby increasing the possibility of code reuse.
Polymorphism (Polymorphism)
The template polymorphism allows you to handle alternative behaviors based on the type. In this case, alternative implementations are reduced to a generic interface.
Consider the integration of the system with external components of the calculation of tariffs for shipping. The LocalTarificator and WorldWideTarificator classes are adapters to the corresponding external components.

The use of the template polymorphism allows in the future to easily modify the system.
Pure Fabrication
There is the notion of a programming model for the domain, according to which one or more classes of the software environment corresponds to each entity from the subject domain. In this case, the responsibilities of the interaction of entities, as a rule, are imposed on themselves. This approach has an obvious drawback - the high connectivity of the modules of the system. The pure fiction pattern allows you to solve this problem by introducing into the software environment an additional class (which does not reflect the real essence of the subject area) and endowing it with the required responsibilities.
For example, the responsibility to retain customer information of a shipping company can be assigned to the fictional class ClientsSaver.

The use of the template pure invention allows the design of the system to comply with the principles of low connectivity and high gearing.
Redirection (Indirection)
The redirection pattern implements low connectivity between classes by assigning responsibilities for their interaction to an additional object, the mediator.
An example of this pattern is the ClientsSaver class (see Net Fiction), which is an intermediate layer between client entities and the repository in which they will be stored. In addition, the controller from the MVC triad is an intermediary between the data of their representation.