Questions tagged [strategy-pattern]
The strategy-pattern tag has no usage guidance.
13
questions
2
votes
0
answers
151
views
PHP Parser and converter - SOLID and DRY
I am working on a PHP application that transforms data from the input CSV (JSON, TXT, or XML) into an output CSV (JSON or database, for example).
The output format differs from the input: some columns ...
4
votes
3
answers
1k
views
Python Enum Strategy Pattern
I have two behaviours: pulling or cloning a git repository.
It started as an Enum, but then I had to switch over the enum all the time.
I wanted to turn it into some kind of strategy pattern and ...
1
vote
1
answer
115
views
Strategy Pattern Inside State Pattern
I'm making a fps game where I created a hierarchical state machine; the problem is the two types of movement (standing movement and crouching movement). They are very similar; the only difference is ...
3
votes
0
answers
66
views
Entities with varied Movement polymorphic implementations in Julia
I have very basic principle. I have multiple types of entities with some shared functionality. Some of this functionality is highly customizable and you want to be able to swap it out even for a ...
3
votes
1
answer
321
views
Applying the Strategy pattern for payment methods
The strategy pattern is applied in the code below in the payment separation solution. Please evaluate if it is well done according to standards. I would be very grateful for suggestions.
...
2
votes
2
answers
78
views
Virtual method with variations for different types
Each animal type will call reactToOwner() and exhibit its own behaviour. So simply define a reactToOwner() override for each
...
0
votes
1
answer
193
views
Refactor typescript long switch case that run different code in according to property value
I have a typescript function that executes an array of actions on a given string value. This is the code:
...
0
votes
2
answers
394
views
Strategy Design Pattern in ASP.Net Core MVC Project
I tried to make a calculator using the Strategy pattern in ASP.Net Core MVC (following an example from the Internet)
Please review my code and tell me what could be wrong and how to make it better?
My ...
0
votes
2
answers
374
views
on using the strategy pattern to switch between database layers
I'd like to build an app in Flask that can switch between talking to a PostGresql and a Mongo DB. As I understand it, the Strategy Pattern is about being able to switch algorithms that are referred ...
3
votes
1
answer
196
views
refactor python strategy pattern to use abstract base class
I came across this strategy pattern implementation
https://github.com/jtortorelli/head-first-design-patterns-python/blob/master/src/python/chapter_1/adventure_game.py
...
2
votes
1
answer
145
views
Implement Strategy pattern for 1. Print Report. 2. Movie type [closed]
I need to know whether I have implemented Strategy pattern correctly for below 3 classes provided to me for 2 tasks.1) Report Generation 2) Movie Type.
Below 3 classes were provided to me
Rental.java
...
1
vote
1
answer
52
views
Generating packing slips depending on product type
My abstract class. Product will have multiple child classes those will be different types of Product
...
3
votes
4
answers
3k
views
Calculator Object Oriented Design
I am aiming to implement a calculator in an object-oriented way.
Here is the solution by using the strategy pattern.
Looking forward to some valuable comments.
...