Geeks With Blogs
Joel Ross

Martin Fowler has a post title DesignedInheritence which talks about the reasoning behind only allowing inheritence where the library developer specifies versus allowing inheritence anywhere. The reasoning for only allowing inheritence where the library developer specifies is the argument that library developers are experts and library users aren't.

He basically goes on to say that he believes in open inheritence, where you rely on the developers using your library to be smart enough to not screw things up - basically, don't get a big ego about how good you are. When you use Designed Inheritence, you're basically putting yourself on a pedastal and saying, "Look at me, all you lowly coders. I have deemed you worthy to use my perfect software."

That's not how the world works. When we build libraries, we have to understand that we don't know how it will be used. That's the whole idea of it being a seperate library. You recognize how you need it, but you're also opening it up to let others use it. The best libraries out there are the ones that get used in ways the original developer didn't take into account - but wrote the library in such a way that it was flexible enough to support those alternate ways.

Recently, I've been involved in building a framework, and this article was right on point with the philosophy that we used when building the framework. It's designed to be a business entity layer that can be used on just about any type of project, and what you get out of the box is huge. But that doesn't mean we can take everything into account that will be needed on any given project. So we took an open inheritence approach - our classes are wide open. You can override just about anything you want, and not one single class is sealed. Not only that, but we also have a whole set of events that you can hook into to manipulate data. Oh, and whoever's using the framework, they get the source to the framework. Not only that, they get the templates that generate the framework.

Can't get much farther from Designed Inheritence than that!

Technorati Tags: | |

Posted on Sunday, October 8, 2006 7:10 PM | Back to top


Comments on this post: Designed vs. Open Inheritence

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Joel Ross | Powered by: GeeksWithBlogs.net