mercredi 5 avril 2023

Which design pattern to implement in order to split the responsibilities?

I have a part of my application that I would like to refactor. The classes involved have too many responsibilities as well as too many dependencies. Different parts of the code that needs refactoring make use of the same app modules. These modules are used in the same way - to check whether another operation can occur.

Example:

  1. The user wants to perform an update - check if the user is signed in.
  2. The user tries to use a paid app feature - check if the user is signed in and has the right to use that feature.

I am seeking for a design pattern that will centralize the logic that is used in too many places in the same way.

Aucun commentaire:

Enregistrer un commentaire