Because the class is the dominant unit in OO systems, fewer metrics have been proposed for operations that reside within a class. Churcher ...
Because the class is the dominant unit in OO systems, fewer metrics have been proposed for operations that reside within a class. Churcher and Shepperd discuss this when they state:
Results of recent studies indicate that methods tend to be small, both in terms of number of statements and in logical complexity , suggesting that connectivity structure of a system may be more important than the content of individual modules.
However, some insights can be gained by examining average characteristics for methods (operations). Three simple metrics, proposed by Lorenz and Kidd , are noted next:
Average operation size (OSavg). Although lines of code could be used as an indicator for operation size, the LOC measure suffers from all the problems that already discussed. For this reason, the number of messages sent by the operation provides an alternative for operation size. As the number of messages sent by a single operation increases, it is likely that responsibilities have not been well-allocated within a class.
Operation complexity (OC). The complexity of an operation can be computed using any of the complexity metrics proposed for conventional software . Because operations should be limited to a specific responsibility, the designer should strive to keep OC as low as possible.
Average number of parameters per operation (NPavg). The larger the number of operation parameters, the more complex the collaboration between objects. In general, NPavg should be kept as low as possible.