Gregory M. KapfhammerAssociate Professor of Computer Sciencehttp://www.cs.allegheny.edu/~gkapfham/ |
OO Design Quality Metrics
- In an object-oriented software system, which classes are the most stable? What does it mean for a class to be stable? Is it desirable for all of the classes in a system to be extremely stable?
The most stable classes are both independent and responsible. They do not depend on anything and they have many classes that depend on the them. They are stable because they are so difficult to change. Many other classes would need to be changed if we changed a stable class.
No it is not desireable for all classes to be stable because then you would not be able to change the system. We usually want some amount of flexibility within the system. Joe Zumpella
Chris Howell
The most stable calsses in an OO software system are those that have good dependencies and those dependencies do not interfere with those desirable qualities and are also independent and responsible. If a class is stable it means that it is very unlikely to change. No, if the classes have to be altered in anyway within the system, it will be very difficult to do if they are all stable. Most classes should be stable, but not all.
- How could we define the abstractness of a category? Are abstract categories always going to be dependent?
We define it by using this metric: (# of abstract classes in a category / total # of classes in a category) where 0 means concrete and 1 means abstract.
No if the category measures out to a 1 in the last metric, it is completely abstract and in that case it will be independent. This
could be considered to be impossible though because a completely abstract category would not really do anything since you do need some concrete classes to fill in the interfaces. So if you look at the question from this standpoint the answer would be yes.
Joe Zumpella
Chris Howell
Abstractness: (# abstract classes in category \ total # of classes in category). The metric range is [0,1]. 0 means concrete and 1 means completely abstract. No, they will not always be dependent.
- Using your responses to the previous two questions, define the understanding of the main sequence of an object-oriented software system. How can we use this metric?
The main sequence is a relationship between abstract classes and concrete classes. The best case scenario seems to be somewhere in the middle of these two extremes. It should not be too abstract for its stability and not too instable for its abstractness. It should have the perfect amount of abstract and concrete classes in proportion to its afferent and its efferent dependencies, as stated in the article. The metric uses to determine the distance from the main sequence is the absolute value of (A+I-1)/2.
We use this metric to measure if the category is close to having the right amount of abstract and concrete classes. Note that this metric is not perfect and is not the ultimate measurement of how well a category is created. Joe Zumpella
Chris Howell
Within the main sequence the categories have degrees of abstrction and stability. For example, it is very common that one abstract class derives from another abstract class. The derivative is an abstraction that has a dependency. Thus though it is maximally abstract, it will not be maximally stabel. Its dependenct will decrease its stability. the category on the main sequence is not too abstract for its stability not is too instable for its abstractness. It has the right number of concrete and abstract classes in proportion to its efferent and afferent dependencies. The most desirable positions for a category to hold are at one of the two endpoints of the main sequence. Only about half of the categories in a projectcan have such ideal characteristics. Those other categories have the best characteristics if they are on or close to the main sequence.
The metrics measure the conformance of a design to a pattern of dependency and abstraction which the author feels is a good pattern.
Let me ask a few follow-up questions. Now that you have developed an understanding of these object-oriented metrics, what steps would you take to analyze a software project that is built in an object-oriented language? Should you set "cut-off" points for the values that a software system must hold on these measures? Should we simply use these measures for informational purposes only? Moreover, should we use these metrics on the long-term project? Greg
Link to this Page
- Software Design last edited on 14 October 2004 at 2:29 pm by aldenv28.allegheny.edu