The Domain/Range Ratio metric proposed by Voas [24] is defined as the ratio of the cardinality of the possible inputs to the range of the possible outputs.
This metric is not directly applicable to object-oriented programs because the number of explicit parameters that are being passed to a method is not a real indication of the loss content in the method. This is because object-oriented languages discourage procedural autonomy and instead organize methods into a collection of operations that share the object state through non-local variables.
We therefore include the attributes defined in a class to be the implicit parameters to all the methods defined in the class. We take this conservative approch at the design phase due to lack of information about the actual set of objects that change their states at runtime. A reformulation of the metric for the coding phase would include only those objects that have been utilized. This redefinition would provide a greater accuracy of the metric.
Adapting the above metric, we introduce a concept termed the visibility component (VC) of a method. It defines the accessibility of objects that may have changed state during the execution of a method. We assume that the implicit and explicit parameters have equal potential to affect the object's current state.
The definition of the visiblity component is defined as
The following are considered to be ``Inputs'' in the calculation of the above metric.
The following are considered to be ``outputs'' in the calculation of the above metric.
Syntactically, C++ allows the definition in the class header of the exception objects that are thrown by a method. We therefore propose that the visibility component of that method includes the visiblity component of its exception objects too. The inherent assumption is that the exception objects that are thrown by the method include information about the state of the object and the correctness of execution just as do the implicit and explicit parameters to the method.
Future extensions of this work may include the calculation of information loss content based on the individual complexities of the thrown objects.