November 27, 2007

...Learn TDD with Codemanship

Class Distance From The Main Sequence

Just a quick post to put an idea out there.

Yes. Another half-baked idea... But bear with me for a minute.

So, fans of OO design quality metrics (and that's all six of us I'm talking to) will be familiar with a metric that indicates whether our inter-package dependencies are tending to go towards more abstract packages. It's called distance from the main sequence. The design principle it's based on is the Stable Abstractions principles, which states clearly that packages that are more depended upon should be more open to extension and less open to modification - i.e., more abstract.

It occurs to me that the same goes at the class level. But we tend to just think of abstractness of classes as being two-valued - abstract or not abstract.

But is an abstract class with some methods implemented and others left purely virtual as abstract as an interface with no implementation at all? I don't think so. I think the interface is totally abstract and the abstract class is partially abstract. And therefore, I reckon we could propose a measure of class abstractness. Since classes can have efferent and afferent couplings (outgoing and incoming dependencies on other classes), it would therefore be possible to come up with a distance from the main sequence style of metric for classes as well as packages.

The mind boggles!
Posted 13 years, 3 months ago on November 27, 2007