I believe what you are describing is the repository pattern. A data store abstraction.
In my understanding, a strategy pattern is supposed to offer different behaviour with a common interface. Usually the example has to do with calculating prices where one strategy may apply on weekdays and another might apply discounts for happy hour. This gives you the ability to change program behaviour on runtime.
Great observation! In the context of this post, the strategy pattern could be used to import data from a csv file or xml file. The program would figure out which file type is being imported and apply the correct strategy. I will unpublish and make those adjustments. Thank you for the feedback!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I believe what you are describing is the repository pattern. A data store abstraction.
In my understanding, a strategy pattern is supposed to offer different behaviour with a common interface. Usually the example has to do with calculating prices where one strategy may apply on weekdays and another might apply discounts for happy hour. This gives you the ability to change program behaviour on runtime.
I have updated the post based on your feedback to apply the strategy pattern to importing data into an application from different sources.
Much better example now, great effort!
Great observation! In the context of this post, the strategy pattern could be used to import data from a csv file or xml file. The program would figure out which file type is being imported and apply the correct strategy. I will unpublish and make those adjustments. Thank you for the feedback!