0

I have a program that contains client and api logic.

In summary client works like this:

1) Client handles client code
2) Calling the API is surrounded in (lets call it ) ClientService
3) if client needs to retrieve or do something from api it calls ClientService method that has some added business logic and calls the api 

The api is basicly proxy around another proprietary service/API, so according to clean code if proprietary api has methods

readData()
pushData()
deleteData()

the proxy has the same methods

readData()
pushData()
deleteData()

that calls this methods and maybe do some logging.

Now since i do need business logic in API too, I created another service Called proxyService.

This means all logic is handled in proxyService which does call to proxy for primitive calls to API.

Now my questions are

1) proxy returns directly proprietary API objects to proxyService, that rebuilds in into Objects defined in my API module, so inside my API module I return and work with proprietary API objects, but API returns objects defined in API module thus not revealing inside implementation - is this correct? the returning proprietary API object directly from the proxy part.

2) How would tests look like? Would be good to mock proxy and test proxyservice? In that case, in tests, I would need to work with proprietary API objects directly (e.g mocks my proxy to return them), is this good practice?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.