Object Oriented Metrics
Object Oriented Metrics
As software systems grow more complex, especially with the adoption of object-oriented programming, it’s important to have ways to measure and assess their quality. These measurements, known as object-oriented metrics, help developers and testers evaluate various aspects of software like maintainability, reusability, and complexity. Understanding these metrics enables teams to improve code quality, make informed decisions, and build robust software systems.
Object Oriented Metrics are quantitative measures used to assess the characteristics and quality of object-oriented software design. These metrics focus on key object-oriented concepts such as classes, objects, inheritance, encapsulation, coupling, and cohesion. By analyzing these factors, developers can gain insights into the software’s structure and behavior, enabling better design decisions and efficient maintenance.
Object Oriented Metrics List
Object-oriented metrics provide insights into the internal structure of object-oriented programs. They help identify potential design flaws and areas that might become problematic as the system evolves. These metrics are typically grouped into categories such as coupling and cohesion, each offering different perspectives on the software’s architecture and modularity.
Coupling Metrics
Coupling measures how much one class depends on another. Lower coupling is usually better, as it implies that changes in one class are less likely to impact others.
Metric | Description |
---|---|
Coupling Between Objects (CBO) | Measures the number of classes to which a class is coupled. High coupling indicates more dependency and complexity. |
Data Abstraction Coupling | Measures the number of data abstractions (e.g., interfaces, abstract classes) used by a class, reflecting the level of encapsulation. |
Response for a Class (RFC) | Indicates the number of methods that can potentially be executed in response to a message received by an object. Higher RFC implies more complexity. |
Fan-in | Refers to the number of classes that use a particular class. A high fan-in suggests high reuse, but also increased risk when changes are made. |
Fan-out | Indicates the number of classes used by a particular class. Higher fan-out may imply high dependency and lower modularity. |
Cohesion Metrics
Cohesion measures how closely related the responsibilities of a single class are. Higher cohesion usually indicates a well-designed, focused class.
Metric | Description |
---|---|
Lack of Cohesion in Methods (LCOM) | Measures the dissimilarity of methods in a class. High LCOM indicates low cohesion, suggesting the class may need to be split into multiple classes. |
Tight Class Cohesion | Indicates that class methods are strongly related and share common attributes, which is desirable for maintainable design. |
Loose Class Cohesion | Reflects that class methods are not well connected, leading to poor modular design and harder maintenance. |