General Responsibility Assignment Software Patterns.

Creator

  • Who is responsible for creating an object?
  • Making it apparent which objects are responsible for creating other objects.

Controller

  • MVC. Should separate view from model (business logic). Use Controller to coordinate this.

Pure Fabrication

  • When the behavior does not belong anywhere else, create a new class.

Information Expert

  • A class should be responsible for itself, that if there is a responsibility–and we are asking where does this go–we give it to the class that has the most information needed to fulfill it.

High Cohesion

  • Cohesion is a measure of how focused the internal behavior of a class is.
  • Are all its behaviors related to that single responsibility? If so, it has HIGH COHESION.
  • What we want is HIGH COHESION.

Indirection

  • The idea that we can decrease coupling between objects. If you have multiple objects that need to talk to each other, it’s very easy to have HIGH COUPLING between them where there is a lot of dependencies.
  • And what we can do instead is reduce those direct connections and put an indirection object in between them to simplify the amount of connections that each object has to make.

Low Coupling

  • Reduce the amount of required connections between objects.
  • The aim is for LOW COUPLING, reducing dependencies.
  • Objects do need to know about each other, but as much as possible they should do what they can with the minimum of other objects–as many as necessary but as few as possible.

Polymorphism

  • Automatically correct behavior based on type.

Protected Variations

  • How to design a system so that changes and variations have the minimum impact on what already exists.
  • We try to identify the most likely points of change so we can make doubly sure that we create a framework around our application that protects the most sensitive pieces.

Sources:

https://www.linkedin.com/learning/programming-foundations-object-oriented-design-2012/introduction-to-grasp-principles

Last modified: March 17, 2019

Author

Comments

Write a Reply or Comment