|
In the usual Strategy Pattern, we make each strategy as a class. Can't we make it a function, and just assign the reference to the function when we instantiate an object, and let the object call that function?
Started by Jian Lin on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Take a look at this blog post of a strategy object..
In C# you can use delegates with the strategy pattern.
However, consider this case
class encapsulated way).
Cases, you can replace Strategy patterns with a function pointer.
|
|
Feedback summary I will now close this thead (I think there will be no more feedback) and try to summarize what I understood
using the "Context" as a parameter for my strategy introduces a tight coupling that should be avoided and also could force me ...
Started by FrenchData on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
One issue I see with your approach is that there would a tight coupling between the concrete Context class and the... .
But I prefer pass the context to the strategy through the constructor of the strategy implementation class.
IMHO, it's ok.
|
|
Of course you can regard it as a kind of strategy, but that applies to almost all the design patterns. So : why?
Started by Peter on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
The idea behind the strategy pattern is that "algorithms can be selected at runtime." (Wikipedia, Strategy....
The name actions.
Of the strategy pattern is to let you choose a way of doing something, a "strategy", at runtime.
|
Ask your Facebook Friends
|
When I first discovered the Strategy pattern, I was amazed of the seemingly endless possibilities it offered to me and my programs. I could better encapsulate my models' behaviour and even exchange this behaviour on the fly. But the strategy could also...
Started by mstrobl on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
For instance you might have.
A strategy is determined at runtime, and in fact can be changed on the fly.
While strategy pattern is available to many (most?) object oriented languages, and languages.
|
|
I am trying to create a web-based tool for my company that, in essence, uses geographic input to produce tabular results. Currently, three different business areas use my tool and receive three different kinds of output. Luckily, all of the outputs are...
Started by DonaldRay on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
If you truly want new....
However, when it comes to extensibility, things are different.
As long as the big if block or switch statement or whatever it is appears in only one place, it isn't bad for maintainability, so don't worry about it for that reason .
|
|
Strategy coders, join FXCM in 10 free webinars on strategy coding FXCM would like to invite you to join our new webinar series on strategy coding for Strategy Trader . In this expansive ten week series, we’ll cover topics ranging from the basics of strategy...
Started by DailyFX Forum Administrator on
, 15 posts
by 8 people.
Answer Snippets (Read the full thread at dailyfx):
• Combining these elements....
• Customizing your indicator and coding your strategy.
WEEK 1 – BASICS OF STRATEGIES
Follow Claudio in a step by step construction of a complete strategy strategy using inputs for new variables.
|
|
I need to create a class which will be responsible for result set processing but it might happen that different algorithms should be used to process that result set.
I am aware of the following options:
1) Use Strategy patern, below is pseudo code:
interface...
Started by Kumar on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
The strategy pattern in this....
I have done desire.
The patterns a word of warning: don't stretch too hard to separate your client from your strategy.
It's definitely a combination of Strategy and Factory - but I don't think that's bad.
|
|
When implementing the Strategy Pattern, where does one put the code that determines which strategy to use? Some sample pseudo-code would help.
Started by Tato on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
The....
Lets say for instance that you have the Character posesses at the time .
Sometimes one can resolve the strategy by the client of the Objects that use the Strategy Pattern.
It all depends when you resolve which strategy to take.
|
|
What is the difference between strategy pattern and delegation pattern (not delegates)?
Started by hIpPy on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
The Strategy pattern,on the other hand, is a specific pattern which typically the strategy pattern and invoke it using
strategy.execute(x)
The strategy pattern involves having various implementations of ....
Be used in many contexts.
|
|
Can anyone explain exactly how the Strategy Pattern relates to Inversion of Control?
Started by Shane on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
This is where IoC....
One way to do this is to have the concrete strategy injected into a class strategy.
When you use the strategy pattern, you want your other classes to depend on the interface rather than a concrete strategy.
|