Skip to main content
added 490 characters in body
Source Link
Denis
  • 8.5k
  • 5
  • 31
  • 76

EDIT : Added the SwitchCombination class :

    internal class SwitchCombination
{
    private readonly ICombinationAnalyzer _combinationAnalyzer;

    public SwitchCombination(ICombinationAnalyzer combination)
    {
        _combinationAnalyzer = combination;
    }

    public void CheckCombination(UsersProperties inputUser, int[] inputHand)
    {
        _combinationAnalyzer.Check(inputHand, inputUser);
    }
}

EDIT : Added the SwitchCombination class :

    internal class SwitchCombination
{
    private readonly ICombinationAnalyzer _combinationAnalyzer;

    public SwitchCombination(ICombinationAnalyzer combination)
    {
        _combinationAnalyzer = combination;
    }

    public void CheckCombination(UsersProperties inputUser, int[] inputHand)
    {
        _combinationAnalyzer.Check(inputHand, inputUser);
    }
}
edited tags
Link
Denis
  • 8.5k
  • 5
  • 31
  • 76
deleted 45 characters in body; edited title
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

Strategy pattern improvementusing an abstract class and an interface

iI have implemented some sort of the strategy pattern using an abstract class and an interface  :

CardVariables is just a class where iI keep some variables used in the calculates down below. I dontdon't think there's point in showing it here..

There are a few derived methods imI'm not going to show they're entire content inentirely here because they are quite similar to one another.

Ok so nowNow the problem is where imI'm actually implementing the strategy pattern  :

It's my first time ever doing this pattern and imI'm not sure if it can be made any better but i know that if imI'm writing something similar a couple times there's probably a better way of doing it.. I created list of those Combinations so i can iterate through them this way iI avoid typing switchCombinations.CheckCombination(user, _reserve); all the time. however i cant

However, I can't seem to find a way to reduce the overall size of that and also as i. As I said earlier, it's my first time implementing this pattern and imI'm not sure if it's even effective or if that's the right way to go. Any suggestions are highly appreciated.

Strategy pattern improvement

i have implemented some sort of the strategy pattern using abstract class and interface  :

CardVariables is just a class where i keep some variables used in the calculates down below. I dont think there's point in showing it here..

There are few derived methods im not going to show they're entire content in here because they are quite similar one another.

Ok so now the problem is where im actually implementing the strategy pattern  :

It's my first time ever doing this pattern and im not sure if it can be made any better but i know that if im writing something similar a couple times there's probably a better way of doing it.. I created list of those Combinations so i can iterate through them this way i avoid typing switchCombinations.CheckCombination(user, _reserve); all the time. however i cant seem to find a way to reduce the overall size of that and also as i said earlier it's my first time implementing this pattern and im not sure if it's even effective or if that's the right way to go. Any suggestions are highly appreciated.

Strategy pattern using an abstract class and an interface

I have implemented some sort of the strategy pattern using an abstract class and an interface:

CardVariables is just a class where I keep some variables used in the calculates down below. I don't think there's point in showing it here.

There are a few derived methods I'm not going to show entirely here because they are quite similar to one another.

Now the problem is where I'm actually implementing the strategy pattern:

It's my first time ever doing this pattern and I'm not sure if it can be made any better but i know that if I'm writing something similar a couple times there's probably a better way of doing it. I created list of those Combinations so i can iterate through them this way I avoid typing switchCombinations.CheckCombination(user, _reserve); all the time.

However, I can't seem to find a way to reduce the overall size of that. As I said earlier, it's my first time implementing this pattern and I'm not sure if it's even effective or if that's the right way to go.

added 190 characters in body
Source Link
Denis
  • 8.5k
  • 5
  • 31
  • 76
Loading
Source Link
Denis
  • 8.5k
  • 5
  • 31
  • 76
Loading