3. OOA, OOD and OOP Object-oriented programming
(OOP) is a programming paradigm
based on the concept of "objects",
which may contain data, often
known as attributes; and
methods.
4. Definitions
Object: X = (x, p(x))
x: substantial individual
p(x): collection of properties and methods
Cohesion: refers to what object (of class) will do
Low Cohesion: Does many actions but not focus what it should do
High Cohesion: Should focus what it should do
Coupling: refers to how related / dependent are objects on each other
5. Definitions
Complexity of Object
+ Large number of properties
+ Number of compositions
Scope of Properties
+ Depth of Inheritance
+ Number of Children
6. Metric Properties for Evaluation Criteria
1. Non-coarseness
Not every class can have same value for a metric
2. Non-uniqueness (Notion of Equivalence)
Two classes can have same metric value
3. Design details are important
Even though two classes perform same functions, the details of the
design matter in determining the metric for the class
7. Metric Properties for Evaluation Criteria (cont)
4. Monotonicity
The metric for the combination of two classes can never be less than
the metric for either of the component classes: u(P + Q) > u(P)
5. Non-equivalence of interaction
Interaction between P + Q # Q + R
6. Interaction increases complexity
When two classes are combined, the interactions increase complexity
8. Applied Metrics Suite
1. Weighted Methods Per Class (WMC)
2. Depth Of Inheritance Tree (DIT)
3. Number Of Children (NOC)
4. Coupling Between Object Classes (CBO)
5. Response For A Class (RFC)
6. Lack Of Cohesion In Methods (LCOM)
Examples with project
+ Site A use C++ language
+ Site B use Smalltalk language
Both 6 applied metrics satisfy property 1, 2, 3, 4, 5 except property 6 fails
9. Applied Metrics Suite
1. Weighted Methods Per Class (WMC)
+ To predict how much time and effort to develop and maintain class
+ Large numbers of methods in class will limit possibility of reuse
2.Depth Of Inheritance Tree (DIT)
+ The deeper of class
=> More number of method to inherit => complex to predict
+ The deeper a class is in hierarchy, the greater the reuse of inherited
methods
10. Applied Metrics Suite (cont)
3. Number Of Children (NOC)
If a class has large number of children
=> misuse subclassing
=> require more testing
4. Coupling Between Object Classes (CBO)
Excessive coupling
=> prevent reuse and modular design
=> difficult maintenance
11. Applied Metrics Suite (cont)
5. Response For A Class (RFC)
A large number of method invoked in response
=> Testing and debugging are complicated
=> The greater the complexity of the class
6. Lack Of Cohesion In Methods (LCOM)
Cohesion promotes encapsulation
Low cohesion increase complexity and errors
12. Conclusion
Failing to meet property 6 implies that a complexity metric could increase if a
class is divided into more classes
Possible new set of software metrics for OO design
The suite provides designers and managers with indication of the integrity of
the design
It may serve as a generalized solution when other researchers to develop
metrics for particular purposes or customized environment.