we are modelling an application using the "Service-Provider" pattern, where the service will offer a generic functionality implemented by different providers registered on the service.
The responsibility of the service will be to choose the right provider based on certain conditions.
The layers we currently have are the following ones:
What I don't like about this approach it that the client needs a reference to the providers to access the A definition. I think that normally dependences should go only from one layer to its layer below, right?
One solution could be duplicating the model on the service layer but that would mean duplicating ... and of course we should avoid that:
Another solution could be creating a package only for models, but this could be overkill and also breaks the top - down dependency chain:
I'm not happy with any of these solutions but I currently do not have others. What do you think, do you like any, are there others that I have not thought about?
Thanks in advance.