app-storage icon indicating copy to clipboard operation
app-storage copied to clipboard

Implement This As A Strategy Pattern

Open phidias51 opened this issue 9 years ago • 2 comments

Since the development process often starts by using static JSON files before migrating to other forms of storage, it would be useful if this were implemented as a strategy pattern, with the ability for the developer to switch back and forth between implementations. Something like:

<app-storage config-name="cache+firebase" config="myapp-config.js"></app-storage>

The config file would let you have different named configurations.

[{
  "name":"cache+firebase",
  ... caching config
  ... firebase config
},
{
  "name":"cache+file",
  ... caching config
  ... file config
}
]

phidias51 avatar Jul 15 '16 16:07 phidias51

Hi, thanks for the suggestion. Could you provide a more detailed description of the strategy pattern, or perhaps link to some relevant literature that you think speaks to how it could be applied here?

cdata avatar Jul 20 '16 16:07 cdata

@cdata Here's some information on Strategy Patterns. https://en.wikipedia.org/wiki/Strategy_pattern

In a nutshell, I want to be able to easily switch between different storage strategies. For example, suppose I have a configuration called "dev" that lets me use local JSON files for early development work. Once I'm satisfied with that, I might switch to "stage" mode, where I use a firebase database. What the modes are called should be completely configurable, and there should be some way of a doing a global switch from one mode to the other. Perhaps there might be some global application parameters for this.

phidias51 avatar Jul 20 '16 21:07 phidias51