clint_hill wrote:And so I would wonder how might there be a way to still get the advantages of interfaces yet keep the flexibility of classes. Abstract comes to mind and I was wondering how you guys play this into your designs?
I use interfaces to:
1. Provide an agreed upon signature for two or more developers,
2. Provide a minimal clean access point for an implementation class.
Classes are obviously where all the magic happens and serve a completely different purpose to interfaces. As far as abstract classes go if they only contain abstract members then they are equivalent to an interface anyway.
I find I use interfaces more then base/abstract classes and polymorphism. While polymorphism is extremely powerful and useful the situations to which it is suited for don't appear that regularly.
I don't see a class as being more flexible then an interface, they are used for different things. Unlike classes interfaces can't satisfy any functional requirements but if interfaces are used wisely they can provide the code with clearer and cleaner semantics; thus helping avoid smell and make life easier for maintainers. In more complex designs Interfaces also make it easier for multiple developers to build and subsequently use the software by providing unambiguos APIs.