vendredi 30 septembre 2016

Is there a pattern in JavaScript for loosely coupled objects.

I'm relatively new to JavaScript so apologies if this type of question is an obvious one.

We have an app which uses etcd as its way to store data. What I'm trying to do is implement a way of swapping or alternating between different backend data stores (I'm wanting to use dynamodb).

I come from a C# background so if I was to implement this behaviour in an asp.net app I would use interfaces and dependancy injection.

The best solution I can think of is to have a factory which returns a data store object based upon some configuration setting. I know that TypeScript has interfaces but would prefer to stick to vanilla js if possible.

Any help would be appreciated. Thanks.

Aucun commentaire:

Enregistrer un commentaire