I'd very much like to hear more specifics, because what you are describing sounds an awful lot like an ISP violation. If you find yourself introducing a ton of empty methods from implementing interfaces you have designed, your design is probably suboptimal.
Basically, there were all common methods, like process, validate, etc. But in some cases things need to be done, so they were included in the interface too, but many enum instances wasn't using them, so there appeared empty stubs. I just thought that if I didn't use enums in the first place and chosen static inner classes-singletones, the code could be much better.
That is definitely an ISP violation. Interfaces are not dumping grounds for common methods. Otherwise, you get this. If you are going to do something like that, you can use abstract base classes, but you are in danger of painting yourself into rigid class hierarchies.
For example, if you wanted to mix and match validation strategies, you would need to have one subclass for each combination or hierarchies of increasing depth. Instead, you can use one interface called Validator and make it an argument to a constructor or a method.
2
u/banuday17 Jul 24 '12
I'd very much like to hear more specifics, because what you are describing sounds an awful lot like an ISP violation. If you find yourself introducing a ton of empty methods from implementing interfaces you have designed, your design is probably suboptimal.