Skip to main content

Questions tagged [strategy-pattern]

The tag has no usage guidance.

2 votes
0 answers
149 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 ...
friday-json's user avatar
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 ...
lukstru's user avatar
  • 968
0 votes
1 answer
108 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 ...
Thomas's user avatar
  • 25
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 ...
K.H.'s user avatar
  • 2,668
3 votes
1 answer
317 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. ...
Łukasz Luq's user avatar
2 votes
2 answers
76 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 ...
prestokeys's user avatar
  • 1,371
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: ...
chenny's user avatar
  • 183
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 ...
WarmingZ's user avatar
0 votes
2 answers
372 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 ...
David J.'s user avatar
  • 135
3 votes
1 answer
195 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 ...
David J.'s user avatar
  • 135
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 ...
garima garg's user avatar
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 ...
user3678961's user avatar
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. ...
Neslihan Bozer's user avatar