Oct 01, 2008 / .net
Is this Multiple Interface Inheritance a code smell?

I found myself refactoring to this code today

public class CmsObject : IEntity, IReleaseable, IVersionable<CmsObject>
{ 
    //....
}

I've seen this style of coding before, but I don't normally write code like that. The reason it feels good to me is because the class collaborates with various subsystems, and I have now explicitly defined the interfaces required by those subsystems. So, somehow it feels simpler.

Then I thought "Hang on, doesn't this violate Single Responsibility Principle?"

If I carry on like this, I'll could end up with a class which implements loads of interfaces, with an uncomfortably large surface area.

Thoughts anyone?


You may also like...