I am attempting to determine if this specific problem has a common design pattern. (I am using c# but can understand any language you wish to use)
Class library exposes a function add(int x, int y) : int.
Client application references class library and can call said function.
WCF service references the class library and exposes the add function through the server.
Client application is updated to subscribe to the service contract and proxy classes are generated.
Client now has the ability to call the service function which is executed on the server for computationally expensive tasks.
Client continues to use the local reference to the class library for cheap tasks.
This is the problem I am trying to tackle, I am specifically interested in including some logic to decide if the service instance or local instance should be called.
The logical factors that could decide this are, time complexity, force override from user (via client) to perform task on server. Finally, if the task is being called is via Iron Python then the pre-compiler statement for specific clients will state if they are capable of handling iron python calls locally, if they are not then the service should be used.
MY QUESTION: where should this logic be carried out? I can't decide if the service or local reference should be called from within either the server or local class library reference. So it must be called from the client. It does not feel right to put this responsibility on the client as each client will gain access to this functionality, so should I create a separate layer (like the data access layer) that wraps this functionality?
SECOND QUESTION: Is this a common problem? Can any one direct me to some design patterns for this specific problem.
Client - > Wraps add(int,int) decides which instance to call (server or local version) -> Service -> Class library add(int,int) [runs on server] -> Class library add(int,int) [runs locally]
Aucun commentaire:
Enregistrer un commentaire