dimanche 30 mai 2021

Is this any pattern?

Is this a proxy pattern? I have a Type (say Service) that is composed in a Singleton class (say Controller). When we create an instance of Controller, the Service instance is created. Controllers' main objective is to expose Public APIs, which are necessary for Service clients. As a result, the controller prevents the Service class from being directly accessed.

There are some cases where the Controller performs a pre-validation check before passing the request on to the Service.

According to the Proxy pattern, the "Controller" (Proxy) and the Service implement the Common Service API interface.

In this case, they will not inherit from a common Service API.

Can we refer to this as a Proxy design pattern since the Controller shields service access from the Service? Is it an Adapter? Is this nothing?

Aucun commentaire:

Enregistrer un commentaire