strategy design pattern on discount
I need to use strategy design patter and thee only thing i could think of is for the discounts, but im not sure how it should be implemented.
6 Replies
context?
I agree, more context would be great. But I imagine this is some kind of uni / school task which just wants to see any usage of the pattern?
What I could think of would be having a sales component in your system which should dynamically react on specific pricing policies. That could be discounts, it could however also be different sales logic for different consumer markets, which might be extended without you wanting to touch the initial component tapping into these strategies
A frequent example is travel to a place, for example, you're traveling to work, but you have different strategies to get there. Walking, a bike, a bus, and a car. The strategy is the mode of transportation.
Each mode of transportation is its own algorithm that can be used interchangeably