<< back to blog

Is this Multiple Interface Inheritance a code smell?

.net

01 Oct, 2008

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...
.NET Gem Fun
Running FubuMVC on Mono (OSX)
Really Easy Way To Partition an ASP.NET MVC With An Admin Area
Automating .NET development (and NHibernate) with IronRuby + Rake
Get a Rails-Stylee Interactive Shell For Your NHibernate Backed Domain Model
In Memory SQLite Testing with NHibernate
NHibernate Trick
OSX MonoDevelop MVC?
NHibernate: Calling Update Unnecessarily
.NET Config for Multiple Developers

kick it on DotNetKicks.com
blog comments powered by Disqus