Interface Design: Pragmatism vs Dogmatism

Someone pointed out this blog post to me:

http://kirillosenkov.blogspot.com/2007/08/choosing-interface-vs-abstract-class.html

The following quote concerns me:

"An interface should define at most one member."

I cringe at hard-and-fast rules like this.  I understand the author’s sentiment but I guess I would have phrased it like so:

Interfaces should be designed to be provide a minimal surface area to accomplish a specific task.  If that can be one with a single member – great!  Now if that surface area grows too large, consider factoring the one interface into multiple interfaces if the tasks can be cleanly separated.

What constitutes too “large large”? That’s where software developers get paid the big bucks to use good engineering judgment.  🙂

Advertisements
This entry was posted in Software Development. Bookmark the permalink.

2 Responses to Interface Design: Pragmatism vs Dogmatism

  1. Kirill says:

    Well said, Keith. I like your wording more than mine. And, you\’re right. I don\’t like being a purist where rules are minimalistic and should have no exceptions. So if you had an impression I am one, it\’s only due to my poor writing skills.

  2. Keith says:

    Hey Kirill, no problem.  It\’s just that I had a co-worker look at that sentence on your post and try to recommend that we only *ever* design interfaces to have a single member.  After reading your post, I could tell you weren\’t being that stringent.  However people will pick tend to pick out sound bites (if you will) and without the context they can be mis-representative.  If there is anything to learn from this it is this – people take to heart the stuff they read on a fancy looking web page.  It made me rethink what I post and how I can be more precise in my posts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s