Switch interface implementation using configuration

Posted by Marcos on Programmers See other posts from Programmers or by Marcos
Published on 2012-12-17T14:41:59Z Indexed on 2012/12/17 17:13 UTC
Read the original article Hit count: 538

We want to allow the same core service to be either fully implemented or, as other option, to be a proxy toward a client legacy system (via a WSDL for example).

In that way, we have both implementation (proxy & full) and we switch which one to use in the configuration of the app.

So in a nutshell, Some desired features:

  • Two different implementation (proxy, full) instead of one implementation with a switch inside
  • Switch implementation using configuration: dependency injection? reflection?
  • Nice-to-have: the packaged delivered to the client doesn’t have to change depending on the choice between proxy or full
  • Nice-to-have: Client can develop their custom implementation of the Core Interface and configure the applciation to use that one

With this background, the question is: What alternatives we have to choose one implementation or other of an interface just changing configuration?

Thanks

© Programmers or respective owner

Related posts about design-patterns

Related posts about interfaces