samedi 19 décembre 2020

What is the counterpart (pattern) to services on the client side?

Let's say i do have a service, which is just a REST-API. This rest api provides some data.

As far as i understand, which makes sense, I can encapsulate data, which is sent from and to this service into DTO's. This totaly makes sense, since you'll have some business objects but often you'll need to serialize them in a way. So as far as i understand this would be a generally accepted and know way to abstract it regarding this part.

Then this DTO's are sent trough the REST-API. Regarding the server side it seams pretty straight forward, having some controllers which provide the data or receive them, I'm not seeing any issues there (at least for now).


So regarding my question. On the client side there are objects, which will access this API, this object, in my implementation contains a http client (not sure maybe i decouple them from this objects) and also it contains methods to access the api. So in one way or another, abstracting the use of http client and accessing the API away.

HOW DO YOU NAME THIS OBJECTS ACCESSING THE API?

I'm now naming them XXXManager/XXXHandler/..., but this names feel far to generic and i feel like there has to be some convention or pattern for this? Naming them XXXService also does not feel not completely right, because service for me is like the server side part, this object are accessing the service.


So how would you name this kind of objects and are there some deeper patterns to handle this kind of service/api accessors?

Aucun commentaire:

Enregistrer un commentaire