I'm going to create some classes to deal with 3rd party API providers. These APIs could be very different how they communicate. I have identified some common functions like,
- Query products
- Create order
- Cancel order
But internal functionality of these methods are different for each API provider. So in my opinion I'm going to create interface/abstract class to hold these functionality and extend them for each API provider.
The problem is selecting which provider should instantiate at runtime with it's own configurations.
I'm pretty sure this is a very common issue and there should be a design pattern to address the situation. I've followed factory design pattern and factory method design pattern. But would like to get some expert advice to put me on correct track.
Aucun commentaire:
Enregistrer un commentaire