In context of MVC, how would you classify a class that drives an API?
That is, in MVC there is a controller, view, and model. My class specifically drives a 3rd-party PDF API that draws text or images on a PDF. You can use the API directly, and it was the case in my codebase at first. Later, certain patterns emerged, say for example a page header and a page footer essentialy had the same code, so the "API Driver" class was born, to store common bare-API patterns.
Is this PdfApiDriver
a controller? a repository? a service? a library? Something else?
It doesn't strike me as Controller, because I call PdfApiDriver
from my controller. It is not repository as it doesn't store any data really. Text for the footer is located in its own repository class. I'm not sure as for the rest.
It strikes me a little bit as my own custom library extension from the original library. Customizing it that way makes it easy for me to assemble my own PDF using my own custom business functions.
Aucun commentaire:
Enregistrer un commentaire