Restrict client access to some not all of a service’s functionalities [closed]

  softwareengineering

I am looking into the design for a new feature, which will be packaged and used by other internal apps. I want to employ some design principles but I also want to keep things as simple as possible. I thought of a simple solution, but I have one more hurdle. I want the service to have various functionalities A B C D, and the client apps to configure which ones they need on application init, but I don’t want the clients to have access to all of them.

So for example I have iABCService with iA, iB, iC fields, client app initializes ABCServices and inserts it through dependency injection whenever needed, as well as sets up A and B objects for iA and iB (we might have AA, BB as well, so a strategy or factory pattern approach)

In this case I don’t want the client app to to use iC of ABCServices at all, but I’m not sure how to do this elegantly – I could check whether it’s set or not in getC method or similar, but this seems rather hacky.

So, do you have any suggestions for a more cohesive way of doing this? As well as any other approach that you might find more useful. Thank you!

New contributor

Ileana Profeanu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

2

LEAVE A COMMENT