mercredi 21 septembre 2016

PHP Design Pattern in APIs

I am trying to find a reasonable explanation of how a particular API is coded. The prevailing MVC pattern doesn't really fit when trying to neatly explain the pattern used behind the API. I'd like to see if anyone knows if the below pattern fits any conventional design pattern. I realize patterns are just abstract concepts and we are not trying to lock into one (which would be silly), but my curiosity is killing me on this one.

(Incoming Request) -> [ROUTER] Passes request to proper class and passes the request's data to the method to be used.

[CONTROLLER] Method responsible for handling raw request data and composing a response. The method instantiates all necessary classes to fulfill the request and prepares supporting classes which require their dependencies to be Injected.

[MODELS] Collection of classes responsible for handling cache, database and file manipulation. All the lower level business logic if you will.

[CONTROLLER] Organizes all data returned from models and prepares a final response and any high-level business logic.

<-(JSON response)

The API has no responsibility for creating a view/interface, only composing a data resource used by the requesting app or website.

Is there a pattern that describes this?

Aucun commentaire:

Enregistrer un commentaire