1

I have a enum based and complicated structure. I want to change my structure with object oriented structure. You must know this there are too much states. So I searched in Internet and I found solutions like that http://blogs.microsoft.co.il/gilf/2009/11/22/applying-strategy-pattern-instead-of-using-switch-statements/,

Ways to eliminate switch in code .

When I apply this solutions, there will be too much classes. What do you think about it, Should I apply like that.

1 Answers1

0

Yes, definitely. You should go for the Strategy solution.

And in my experience, there is almost never a case of too much classes, as you put it. On the contrary, the more modular your code is, the easier it is to test/maintain/deploy it.

You'll run a lot in the opposite problem: a class you thought is small enough and there will be no reason to change, and then after a change in the requirements or a refactoring you see that you need to make it more modular.

Matei Florescu
  • 1,155
  • 11
  • 23