Questions tagged [strategy]
A strategy is a general approach used to achieve goals, to address similar needs, or to solve a family of issues.
82
questions
-2
votes
0
answers
29
views
How would you manage an application that serves multiple customers?
Maybe, this question is too broad to belong to this community. In such case, I’m sorry.
The topic is simple. At work, we have a Web application. It has some bad defects, mostly in terms of ...
1
vote
1
answer
810
views
Branching strategy for developing multiple features at the same time
We are doing a mobile app development and currently, we have Dev - UAT - Stating - Main branches.
We branch from the Main branch as feature/fA for feature development.
Do our development in that ...
1
vote
2
answers
112
views
How can I enable user data sovereignty in a B2B SaaS application?
We develop a SaaS solution that processes customer ERP data and provides analyses from it in a front-end. The software is a standard solution and should require as little customization as possible for ...
0
votes
2
answers
240
views
Coffee machine strategy pattern implementation
I came across an article about LSP https://stackify.com/solid-design-liskov-substitution-principle/ . It seems that a strategy pattern could be implemented here but I cannot see how to implement it.
...
-3
votes
1
answer
181
views
Combining Strategies (Design Patterns) [closed]
If I have two boolean variables B1 and B2 whose value combinations cover four independent behavior functions (MFF, MFT, MTF, MTT), then how many concrete strategy (design pattern) classes should I ...
2
votes
1
answer
167
views
How to implement Gang of Four's Lexi's Compositor-Composition?
I'm studying Design Patterns book and I was trying to understand the Composition principle in Lexi's Compositor-Composition as explained in figure 2.5, as well as how to implement it.
Where the ...
0
votes
3
answers
117
views
Strategy & Architectural Decision: Customer data migration between two companies
Asked this originally here, and didn't receive any answer so far, hence posting here too.
Let's say company A acquired company B in a certain region. This means, A and B were competitors in that ...
-4
votes
5
answers
2k
views
Disadvantage of the strategy pattern and how to overcome it
An often quoted disadvantage of the strategy pattern is:
The application must be aware of all the strategies to select the
right one for the right situation
Why is this a disadvantage and what can ...
7
votes
2
answers
419
views
The "real and effective" GIT CI/CD strategy
I've started in this new company a few weeks ago, this is the CTO CI strategy:
Current: Developer team has the repo prod/master and they merge everything into master (no branching strategy).
Once the ...
0
votes
1
answer
1k
views
Discount calculation pattern
I am implementing a discount calculation model. One item PER order.
I do have a Product class:
public class Product
{
public string Name { get; set; }
public Size Size { get; set; }
public ...
2
votes
3
answers
1k
views
Reconciling MVC with a strategy pattern
I am working on a Rails application which employs a classic MVC as its fundamental structure. In that structure the controller is supposed to be responsible for "which view to render when".
Now after ...
17
votes
5
answers
2k
views
How to comprehend abstraction in code?
When looking at a new codebase I like to start from a bottom-up approach.
Where I comprehend one file and then move up to the next abstraction.
But often times I find myself forgetting what the ...
1
vote
1
answer
123
views
(Fuzzy) Data duplication detection - scoring systems strategy
Many systems that store data in a structured manner (although this is marked language agnostic, the origin of this question is an MS SQL database) struggle with duplicates.
Taking a physical person/...
0
votes
2
answers
152
views
Strategy to review all occurrences of specific field in large project
The project I am working on has a status field which currently only allows YES or NO, and I am about to refactor it to allow the value MAYBE. Unfortunately, it is used over 1,000 times in 200+ files.
...
11
votes
4
answers
4k
views
Rich domain model vs strategy pattern in DDD
I've recently watched a few Pluralshigh courses on DDD by Vladimir Khorikov. He was encouraging to create a rich instead of anemic domain models. It all looked very nice in a small test-project, ...
2
votes
2
answers
861
views
Algorithm for splitting players into unique group every round
For a match I have certain number of players, certain number of groups (players and groups are aliquot) and certain number of rounds to be played (players are reshuffled every round). Ideally, I'd ...
3
votes
2
answers
2k
views
Internal REST API versioning strategy
We are developing internal api's for integrating the server side logic (backend) with frontend (web, mobile etc). We have a java stack in our backend and front end is coded in react and react native. ...
1
vote
1
answer
167
views
Objective-C: Strategy Pattern, is mainly by selector?
To use Strategy Pattern in Objective-C, I think it is mainly by selector.
To omit if...else, use Objective-C runtime, convert string matching to choose selector (Strategy).
Am my understanding ...
2
votes
1
answer
136
views
Looking for a strategy to ensure name of child node stays unique in collection
Even though I'm programming in PHP, I'm open to reviewing language-agnostic suggestions, as they might point me to valuable directions.
To remove any possible confusion I feel some comments appear to ...
1
vote
1
answer
142
views
Inheritance or strategy in my circular buffer
I've looked at some other threads but they don't quite answer my question, I think...
I have a CircularBuffer object which I have separated from a ThreadSafeCircularBuffer object so that the CB logic ...
-2
votes
1
answer
58
views
What method/ approach is used to query a user's page on a website using backslash + username? [closed]
I am working on a Servlet/JSP project, the website have users and I need to display a user's profile using the notation myDomain.com/Joe instead of myDomain.com/users.jsp?user=Joe.
An instance of my ...
0
votes
1
answer
307
views
How To: .Net periodic task to validate entries in tables
I am looking for a solution following best practices to simply periodically validate database entries against some business logic.
For instance, I have the database with employees, and another table ...
16
votes
2
answers
12k
views
What do I use as an alternative to Domain-Driven Design, if I cannot define a Competitive-Advantage area of my system to apply it?
From all I read and watch, Domain-Driven Design (DDD), is a costly and time-consuming endeavor. In fact, everyone I have seen, including Eric Evans and Greg Young, say, don't use DDD except where you ...
5
votes
1
answer
399
views
When can client code know about strategy pattern implementations?
I am considering using a strategy pattern for configuration file management, that way I can support some legacy configs. I feel pretty solid on the overall design (as its pretty standard strategy ...
0
votes
1
answer
488
views
For learning purposes, how should I set about implementing an arbitrary precision library in C or C++?
I know I am reinventing the wheel. But I'm really interested in implementing arbitrary precision numbers (integers, rationals, complex, etc) in C or C++ and their algorithms. Please be patient.
My ...
0
votes
1
answer
2k
views
How to design a Rule Engine Validation System to be asynchronous and highly performant!
I am implementing a validation system which has some constraints, there are category of users let's say 30 and for each category there are number of rules. Actually there are 100 different rules.
I ...
0
votes
3
answers
8k
views
Strategy Pattern with abstract class instead of interface?
Is the strategy in the strategy pattern always an interface? What pattern would it be when the strategy is abstract?
2
votes
2
answers
875
views
Best approach parsing input in multiple scenarios
I am developing an API that has one call that accepts a big JSON object.
Based on this object, there are 10 possible parsing scenarios, i.e. if field xxxx.xxx is present, go with scenario 5.
We ...
1
vote
1
answer
98
views
How to build visibility into a background worker service?
I have been working on a cloud-based background worker service, and regrettably it is almost "blind". What I mean by this is it is incredibly difficult to get any insight into what is going on, aside ...
3
votes
3
answers
744
views
Should you refactor all helper classes into small obects with state?
Imagine you want to have a room painted. You are the owner of this room and a Painter is capable of painting the room. There are different types of Painters: a BluePainter, a RedPainter etc. For every ...
3
votes
2
answers
5k
views
Implementing strategy pattern multiple variables?
I am trying to implement Strategy Pattern for handling my content serialization and deserialization.
So I have four kind of requests namely CREATE, RETRIEVE, UPDATE, DELETE and for each request I want ...
3
votes
1
answer
151
views
What is the best serial port connection strategy
I am developing a program that polls a device for actvity. In the past I have always used a USB device with a pure USB device driver. The upside of this was that that device was blazingly fast. The ...
5
votes
2
answers
646
views
Does such a design pattern exist? (Multi-Strategy/Multi-Traits)
Is there a design pattern that would allow a class from a hierarchy to 'subscribe to' concrete methods?
For example, say you have an abstract base class that requires the implementation of a method.
...
15
votes
2
answers
3k
views
Zero Downtime Deployment - Transitional Db Schema
Achieving Zero Downtime Deployment touched on the same issue but I need some advice on a strategy that I am considering.
Context
A web-based application with Apache/PHP for server-side processing and ...
3
votes
1
answer
805
views
Persistence Strategies - Filling a cache strategy
Let's say I have an interface IDataAccessObject<TSource> with CRUD methods to access a data source.
I have an implementation StrategyDataAccessObject<TSource>, which uses an strategy ...
2
votes
1
answer
803
views
Best Possible Way To Write Unit Tests For HTTP Middleware
I am using this go library(https://github.com/abourget/goproxy) to create a custom proxy server app. The app is utilizing several middleware of the following form:
MyMiddlewarFunc(ctx *goproxy....
1
vote
0
answers
61
views
Strategies for creating a mobile site? [closed]
I'm looking for 2nd & 3rd opinions on a general mobile strategy for a website I work with. We have decided that tablets generally have an acceptable experience with our site (especially in ...
3
votes
3
answers
2k
views
Why do we need a context class in strategy pattern?
For the strategy pattern, why do we need a context class to call the appropriate algorithm? Why can't we just do Strategy s = new OperationAdd()? This way, we still use polymorphism.
18
votes
6
answers
11k
views
Advantages of Strategy Pattern
Why is it beneficial to use the strategy pattern if you can just write your code in if/then cases?
For example: I have a TaxPayer class, and one of its methods calculates the taxes using different ...
2
votes
4
answers
458
views
Strategy pattern and "Is a" relationship
Imagine, I have class IAlgo which is an interface. I have derived from him and implemented his single method called matchCount in different implementations - AlgoA1, AlgoA2, AlgoA3, AlgoB1, AlgoB2.
...
2
votes
1
answer
240
views
Injection, strategies and OO
I'm working on refactoring a project. The business logic looks very much like using the Strategy pattern would be very beneficial, because depending on the values of three properties (let's say age, ...
2
votes
1
answer
910
views
Decorater pattern or strategy pattern
I'm constructing a c# serverside application and I'm trying to do this in a way it can easily be maintained aswell as extended if needed.
So what we have is 4 different requests that need to be done (...
1
vote
1
answer
736
views
Should factory make context or concrete strategies objects in strategy-factory pattern?
In a typical strategy pattern
class Strategy
{
public:
virtual int execute() const = 0;
}
class StrategyA : public Strategy
{
public:
int execute() const override;
}
class StrategyB : ...
4
votes
2
answers
4k
views
Pattern for caching DAOs: strategy or decorator?
I'm building a php system with the Services/DAOs/Domain Models pattern, and now is the time to implement a caching system for the DAOs.
Would you use a decorator pattern, or maybe the strategy ...
4
votes
1
answer
974
views
Creating/updating entity save strategy
Please note: although I'm talking about Java in this question, what I'm asking about here should really be language-agnostic.
I am dabbling in OR/M for the first time, and have cooked up the ...
0
votes
1
answer
430
views
How to organize conversion logic for strategy pattern?
I have a Color class. It has a property model which is a class that implements ColorModel interface, this property could be a RGB, Hex or HSL classes which implementing ColorModel interface.
// ...
0
votes
1
answer
135
views
How to compute data for charting?
I'm building a charting component that displays data directly from the raw data records. It should be able to filter data (subset) and then perform some rudimentry maths on the data (sum, avg, etc). ...
1
vote
1
answer
429
views
Strategy vs Publiser-subscriber pattern
Let's say I have a channel endpoint where I receive messages. Because I want to process messages in a different way depending on its Header property, rather than create a massive switch I create ...
4
votes
2
answers
428
views
Strategy game, how do I calculate the parallel actions?
I am building a strategy game where multiple units(5 - 20) fighting each other.
I have a game logic that calculate all the actions that been done on each turn, and send it to the game engine to ...
3
votes
2
answers
592
views
What do I gain by using the Strategy pattern in this case?
I wrote a program with Java that plays simple music. Currently chords have only one way ('strumming pattern') to be played. I want to expand this and create different 'strumming patterns' that chords ...