Create many similar classes, or just one
- by soandos
The goal is to create an application that has objects that can represent some operations (add, subtract, etc).
All of those objects will have common functions and members, and thus will either implement an interface or inherit from an abstract class (Which would be better practice, this will be in C# if that matters?).
As far as I can see, there are two different ways of organizing all of these classes.
I could create an addition class, a subtraction class, etc. This has the upside of being highly modular but the difference between classes is so minimal.
I could create one class, and have a member that will say what type of operation is being represented. This means lots of switch statements, and losing some modularity, in addition to being harder to maintain.
Which is is better practice? Is there a better way of doing that is not listed above? If it matters, the list of functions that should be supported is long.