Coupling Corruption Propagation Is OO Metric

May 15, 2014

The Coupling Corruption Propagation is a OO metric that computed as follows:

Coupling Corruption Propagation = Number of child methods invoked with the parameters based on the parameters of the original invocation.

In the code bellow, a parent method calculateStringBuildSpeed invokes a child method called buildString with the parameter length. The method buildString then calls three child methods of its own callStartTime, callEndTime, and reportResult. The methods callStartTim and callEndTime do not take any parameter.

Therefore, they are effectively immune to any coupling effects that originate from calculateStringBuildSpeed.

However, reportResult takes one variable stringLength that is calculated from the original length variable. If the variable is ever compromised (i.e., it becomes null, has a value that exceeds the int range, or contains a value that reportResult cannot use), then reportResult method could indirectly be corrupted from calculateStringBuildSpeed. Therefore, the coupling corruption propagation is 2 in the following code.

So how can I modify the following code so that the Coupling Corruption Propagation will decrease for example into 1 or 0

Public void CalculateStringBuildSpeed(double
numOfElements)
{
buildString (numOfElements);
}
.
.
.
public String buildString(double length) {

[Code] ....

View Replies


ADVERTISEMENT

Making A Program That Could Convert Metric Units Into American System

Aug 31, 2014

I just started programming yesterday, and I have been making little programs to learn some algorithms and the syntax of java. I tried making a program that could convert metric units into the American system. Whenever I try to compile the code, it shows up as an "incompatible type" error. I know this is probably a very obvious answer to most of you, but I can't figure it out.

import java.util.Scanner;
public class MetricToAmerican
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("fWhat measurement would you like to convert into US system?
celsius, meter, or kilogram ");

[code]....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved