40
WEYUKER PROPERTIES WEYUKER PROPERTIES VS VS MEASUREMENT IN THE PHYSICAL MEASUREMENT IN THE PHYSICAL SCIENCES SCIENCES

Weyuker Properties

Embed Size (px)

Citation preview

Page 1: Weyuker Properties

WEYUKER PROPERTIESWEYUKER PROPERTIESVSVS

MEASUREMENT IN THE PHYSICAL MEASUREMENT IN THE PHYSICAL SCIENCESSCIENCES

Page 2: Weyuker Properties

OUTLINEOUTLINE

► IntroductionIntroduction►Weyuker’s PropertiesWeyuker’s Properties►Software measurementSoftware measurement►Evaluation of Weyuker’s propertiesEvaluation of Weyuker’s properties►Measurement theoryMeasurement theory► Whether software measurement is Whether software measurement is

really measurement in the physical really measurement in the physical sciencessciences

►ConclusionConclusion

Page 3: Weyuker Properties

► IntroductionIntroduction►Weyuker’s PropertiesWeyuker’s Properties►Software measurementSoftware measurement►Evaluation of Weyuker’s propertiesEvaluation of Weyuker’s properties►Measurement theoryMeasurement theory► Whether software measurement is Whether software measurement is

really measurement in the physical really measurement in the physical sciencessciences

►ConclusionConclusion

Page 4: Weyuker Properties

INTRODUCTIONINTRODUCTION

► Weyuker proposed nine properties for the Weyuker proposed nine properties for the evaluation of software complexity metric.evaluation of software complexity metric.

► None of these measures satisfied all of Weyuker’s None of these measures satisfied all of Weyuker’s properties.properties.

► I look at the foundation of measurement theory and I look at the foundation of measurement theory and ask whether software measurement is ask whether software measurement is measurement in sense of measurement in the measurement in sense of measurement in the physical sciences.physical sciences.

► Thus, if we accept Weyuker’s properties, we would Thus, if we accept Weyuker’s properties, we would see that software measurement does not have see that software measurement does not have additive properties for all metric.additive properties for all metric.

► This research is the basis of a paper that was This research is the basis of a paper that was accepted for presentation in (what conference).accepted for presentation in (what conference).

Page 5: Weyuker Properties

► IntroductionIntroduction►Weyuker’s PropertiesWeyuker’s Properties►Software measurementSoftware measurement► Evaluation of Weyuker’s propertiesEvaluation of Weyuker’s properties►Measurement theoryMeasurement theory► Whether software measurement is Whether software measurement is

really measurement in the physical really measurement in the physical sciencessciences

►ConclusionConclusion

Page 6: Weyuker Properties

WEYUKER’S PROPERTIESWEYUKER’S PROPERTIES

►1. Property One:1. Property One:

There are at least two programs with There are at least two programs with differing complexity.differing complexity.

►2. Property Two:2. Property Two:

There are only a finite number of There are only a finite number of programs of the same complexity.programs of the same complexity.

Page 7: Weyuker Properties

► 3. Property Three:3. Property Three:This property states that there are multiple This property states that there are multiple programs of the same complexity.programs of the same complexity.

► 4.4. Property Four:Property Four:This item expresses the condition that there This item expresses the condition that there are functionally equivalent programs with are functionally equivalent programs with different complexities.different complexities.

► 5.5. Property Five:Property Five:This property is satisfied for monotonic This property is satisfied for monotonic measures. It roughly expresses the fact that measures. It roughly expresses the fact that adding on to a program makes a more adding on to a program makes a more complex program.complex program.

Page 8: Weyuker Properties

► 6.6. Property Six A:Property Six A:This property is a contextual property. Code occurring This property is a contextual property. Code occurring after different but equally complex prologues may be after different but equally complex prologues may be differently affected by the distinct prologues (at least differently affected by the distinct prologues (at least regarding its complexity). This is an interprogram regarding its complexity). This is an interprogram property.property.

► Property Six B:Property Six B: This property is similar to the previous one except This property is similar to the previous one except

that the identical code occurs at the beginning of the that the identical code occurs at the beginning of the program.program.

► 7.7. Property Seven:Property Seven:

This property states that changing the order of This property states that changing the order of statements may change the complexity of the statements may change the complexity of the programprogram

Page 9: Weyuker Properties

►8. 8. Property Eight:Property Eight:

This property states that uniformly This property states that uniformly changing variable names should not changing variable names should not affect a program’s complexity.affect a program’s complexity.

►9. Property Nine:9. Property Nine:

This property states that a This property states that a combined program may be more combined program may be more complex than its individual parts.complex than its individual parts.

Page 10: Weyuker Properties

► IntroductionIntroduction►Weyuker’s PropertiesWeyuker’s Properties►Software measurementSoftware measurement► Evaluation of Weyuker’s propertiesEvaluation of Weyuker’s properties►Measurement theoryMeasurement theory► Whether software measurement is Whether software measurement is

really measurement in the physical really measurement in the physical sciencessciences

►ConclusionConclusion

Page 11: Weyuker Properties

SOFTWARE MEASUREMENTSOFTWARE MEASUREMENT

►A metric is known as an indicator. They A metric is known as an indicator. They are quantifiable indices used to are quantifiable indices used to compare software products, processes, compare software products, processes, or projects or to predict their outcomes.or projects or to predict their outcomes.

► In software engineering we measure In software engineering we measure either the size or complexity of an either the size or complexity of an entity.entity.

Page 12: Weyuker Properties

COMPLEXITY MEASURESCOMPLEXITY MEASURES

►A number of metrics has been A number of metrics has been proposed for the measurement of proposed for the measurement of software complexity. However, my software complexity. However, my attention is focused on:attention is focused on: statement count statement count cyclomatic number cyclomatic number Halstead’s metric Halstead’s metric control flow control flow

Page 13: Weyuker Properties

Statement CountStatement Count

►Statement Count is the number of Statement Count is the number of statements in a program. statements in a program.

►For example, let Q be the program For example, let Q be the program body with two statements:body with two statements:

►Q:Q: y y 1 1

x x y+1 y+1 ►Here statement count is 2 Here statement count is 2

Page 14: Weyuker Properties

Cyclomatic numberCyclomatic number

►McCabe’s complexity measure of a McCabe’s complexity measure of a program is defined to be:program is defined to be:

► V = e - n+2p V = e - n+2p

►where e is the number of edges in a where e is the number of edges in a program flow graph, n is the number program flow graph, n is the number of nodes, and p the number of of nodes, and p the number of connected components or cycles. connected components or cycles.

Page 15: Weyuker Properties

►For example: consider the program For example: consider the program below: below:

►G:G:

IF x < 0 THEN IF x < 0 THEN

IF y < 0 THEN y IF y < 0 THEN y -x -x

ELSE y ELSE y x x

ENDEND

ELSE x ELSE x y y

END END

Page 16: Weyuker Properties

IFx<0

THENy<0

THENy-x

END

ELSEyx

END

ELSExy

Page 17: Weyuker Properties

►For the program given, e=8, n=7, For the program given, e=8, n=7, p=3.p=3.

►Substituting these values into the Substituting these values into the equation, McCabe’s complexity equation, McCabe’s complexity measure is:measure is:

►V (G) = 8-7+ 2 (3) = 7.V (G) = 8-7+ 2 (3) = 7.

Page 18: Weyuker Properties

Halstead’s metricsHalstead’s metrics

► To use Halstead’s metrics, we need the following definitions:To use Halstead’s metrics, we need the following definitions:► n1 = number of unique or distinct operatorsn1 = number of unique or distinct operators

appearing in an implementation.appearing in an implementation.► n2 = number of unique or distinct operands appearing in ann2 = number of unique or distinct operands appearing in an

implementation.implementation.► N1 = total usage of all of the operators appearing in an N1 = total usage of all of the operators appearing in an

implementation. implementation. ► N2 = total usage of all the operands appearing in an N2 = total usage of all the operands appearing in an

implementation.implementation.► Vocabulary: n = n1 + n2  Vocabulary: n = n1 + n2  ► Length: Length: N = N1 + N2N = N1 + N2

Page 19: Weyuker Properties

►For example, let P be the program For example, let P be the program bodybody

►P: y P: y x x

►vocabulary can be derived as follows:vocabulary can be derived as follows:►n = n1 + n2 = 1 + 2 = 3.n = n1 + n2 = 1 + 2 = 3.

► length can be derived as follows:length can be derived as follows:►N = N1 + N2 = 1 + 2 = 3. N = N1 + N2 = 1 + 2 = 3.

Page 20: Weyuker Properties

Control flow complexityControl flow complexity

►Control flow complexity is related to Control flow complexity is related to readability, understandability, effort, readability, understandability, effort, testability, maintainability of a process. testability, maintainability of a process.

►Control flow complexities are Control flow complexities are determined by control paths (splits), determined by control paths (splits), synchronizations (joins), loops, and synchronizations (joins), loops, and terminating and beginning points. Thus, terminating and beginning points. Thus, Control flow complexity originated from Control flow complexity originated from the concept of McCabe’s complexity the concept of McCabe’s complexity measure.measure.

Page 21: Weyuker Properties

► For example, a sequential For example, a sequential concatenation is depicted by the concatenation is depicted by the following diagram.following diagram.

► Also, an AND, OR, XOR join or split is Also, an AND, OR, XOR join or split is represented as follows represented as follows

Page 22: Weyuker Properties

► IntroductionIntroduction►Weyuker’s PropertiesWeyuker’s Properties►Software measurementSoftware measurement►Evaluation of Weyuker’s propertiesEvaluation of Weyuker’s properties►Measurement theoryMeasurement theory► Whether software measurement is Whether software measurement is

really measurement in the physical really measurement in the physical sciencessciences

►ConclusionConclusion

Page 23: Weyuker Properties

EVALUATION OF WEYUKER’S EVALUATION OF WEYUKER’S PROPERTIESPROPERTIES

► I discussed the fact that there were some properties I discussed the fact that there were some properties proposed by Weyuker that were satisfied by measurements proposed by Weyuker that were satisfied by measurements in software engineering.in software engineering.

► Property one: Property one: Recall: Property one states that there are at least two Recall: Property one states that there are at least two

programs with differing measures.programs with differing measures.

Examples of complexity measures that satisfy this Examples of complexity measures that satisfy this property are statement count, cyclomatic number, property are statement count, cyclomatic number, Halstead’s metric, and control flow. Halstead’s metric, and control flow.

Page 24: Weyuker Properties

► Property two:Property two: Recall: Property two states that there are only a finiteRecall: Property two states that there are only a finite number of programs of the same complexity.number of programs of the same complexity.

This property does not make sense because unlike This property does not make sense because unlike Weyuker’s proposed language, computer languages like Weyuker’s proposed language, computer languages like C#, Java or C++ does not have finitely many identifiers.C#, Java or C++ does not have finitely many identifiers.

Examples that satisfy this property are statement count Examples that satisfy this property are statement count and Halstead metric.and Halstead metric.

► Property Three: Property Three: Recall: This property states that there are multiple Recall: This property states that there are multiple programs of the same complexity.programs of the same complexity.

Examples of complexity measures that satisfy this Examples of complexity measures that satisfy this property are statement count, cyclomatic number, property are statement count, cyclomatic number, Halstead’s metric, and control flow. Halstead’s metric, and control flow.

Page 25: Weyuker Properties

► Property four:Property four: Recall: This item expresses the condition that there are Recall: This item expresses the condition that there are

functionally equivalent programs with different functionally equivalent programs with different complexities.complexities.

Examples of complexity measures that satisfy this Examples of complexity measures that satisfy this property are statement count, cyclomatic number, property are statement count, cyclomatic number, Halstead’s metric, and control flow.Halstead’s metric, and control flow.

► Property five: Property five: Recall: This property is satisfied for monotonic Recall: This property is satisfied for monotonic

measures. It roughly expresses the fact that adding on measures. It roughly expresses the fact that adding on to a program makes a more complex program.to a program makes a more complex program.

Examples of complexity measures that satisfy this Examples of complexity measures that satisfy this property are statement count, cyclomatic number, property are statement count, cyclomatic number, Halstead’s metric, and control flow.Halstead’s metric, and control flow.

Page 26: Weyuker Properties

► Property six: Property six: Recall: property six states that code occurring after Recall: property six states that code occurring after

different but equally complex prologues may be different but equally complex prologues may be differently affected by the distinct prologues (at least differently affected by the distinct prologues (at least regarding its complexity). regarding its complexity).

An example that satisfies this property is Halstead An example that satisfies this property is Halstead metric.metric.

► Property seven: Property seven: Recall: this property states that changing the order of Recall: this property states that changing the order of

statements may change the complexity of the program.statements may change the complexity of the program.

An example that satisfies this property is control flow.An example that satisfies this property is control flow.

Page 27: Weyuker Properties

► Property eight:Property eight: Recall: This property states that uniformly changing Recall: This property states that uniformly changing

variable names should not affect a program’s variable names should not affect a program’s complexity.complexity.

Examples of complexity measures that satisfy this Examples of complexity measures that satisfy this property are statement count, cyclomatic number, property are statement count, cyclomatic number, Halstead’s metric, and control flow.Halstead’s metric, and control flow.

► Property nine: Property nine: Recall: This property states that a combined program Recall: This property states that a combined program

may be more complex than its individual parts.may be more complex than its individual parts.

An example that satisfies this property is control flow.An example that satisfies this property is control flow.

Page 28: Weyuker Properties

► IntroductionIntroduction►Weyuker’s PropertiesWeyuker’s Properties►Software measurementSoftware measurement► Evaluation of Weyuker’s propertiesEvaluation of Weyuker’s properties►Measurement theoryMeasurement theory► Whether software measurement is Whether software measurement is

really measurement in the physical really measurement in the physical sciencessciences

►ConclusionConclusion

Page 29: Weyuker Properties

MEASUREMENT THEORYMEASUREMENT THEORY

► Campbell has two basic laws of measurement Campbell has two basic laws of measurement ► Campbell’s first law states that a metric must Campbell’s first law states that a metric must

measure a relative quantity of an attribute. measure a relative quantity of an attribute. ► Given that A, B, C, and D are entities and that Given that A, B, C, and D are entities and that

+ means combining entities, Campbell’s + means combining entities, Campbell’s second measurement law requires the second measurement law requires the following:following: 1. If A = B and C > 0, then A + C > B.1. If A = B and C > 0, then A + C > B. 2. If A + D = X, then D + A = X.2. If A + D = X, then D + A = X. 3. If A = B and C = D, then A + C = B + D.3. If A = B and C = D, then A + C = B + D. 4. If A = B, C = D, and E = F, then (A + C) + E = B + 4. If A = B, C = D, and E = F, then (A + C) + E = B +

(D + F).(D + F).

Page 30: Weyuker Properties

► IntroductionIntroduction►Weyuker’s PropertiesWeyuker’s Properties►Software measurementSoftware measurement► Evaluation of Weyuker’s propertiesEvaluation of Weyuker’s properties►Measurement theoryMeasurement theory► Whether software measurement Whether software measurement

is really measurement in the is really measurement in the physical sciencesphysical sciences

►ConclusionConclusion

Page 31: Weyuker Properties

WHETHER SOFTWARE MEASUREMENT IS WHETHER SOFTWARE MEASUREMENT IS REALLY MEASUREMENT IN THE PHYSICAL REALLY MEASUREMENT IN THE PHYSICAL

SCIENCESSCIENCES► Weyuker’s property six is not in complete Weyuker’s property six is not in complete

agreement with measurement in the agreement with measurement in the Physical Sciences.Physical Sciences.

► Recall: Weyuker’s property six states that Recall: Weyuker’s property six states that code occurring after different but equally code occurring after different but equally complex prologues may be differently complex prologues may be differently affected by the distinct prologues (at least affected by the distinct prologues (at least regarding its complexity). regarding its complexity).

► In the Physical Sciences, the complexity is In the Physical Sciences, the complexity is the same for both P and Q.the same for both P and Q.

► Therefore, joining program R with P and Q Therefore, joining program R with P and Q adds the same amount of complexity. adds the same amount of complexity.

Page 32: Weyuker Properties

► A good example of measurement in the A good example of measurement in the physical sciences is the third part of physical sciences is the third part of Campbell's additive principle which states Campbell's additive principle which states that If A = B and C = D, then A + C = B + D.that If A = B and C = D, then A + C = B + D.

► As we can see, Weyuker’s property six is in As we can see, Weyuker’s property six is in conflict with the third part of Campbell’s conflict with the third part of Campbell’s additive principle. additive principle.

► Thus it is in conflict with Measurement in the Thus it is in conflict with Measurement in the physical sciences.physical sciences.

► Thus, if we accept Weyuker’s properties, we Thus, if we accept Weyuker’s properties, we can see that software measurement does can see that software measurement does not have additive properties for all metric.not have additive properties for all metric.

Page 33: Weyuker Properties

► IntroductionIntroduction►Weyuker’s PropertiesWeyuker’s Properties►Software measurementSoftware measurement►Evaluation of Weyuker’s propertiesEvaluation of Weyuker’s properties►Measurement theoryMeasurement theory► Whether software measurement is Whether software measurement is

really measurement in the physical really measurement in the physical sciencessciences

►ConclusionConclusion

Page 34: Weyuker Properties

CONCLUSIONCONCLUSION

► I looked at the foundation for measurement I looked at the foundation for measurement theory and ask whethertheory and ask whether software measurement software measurement is measurement in the sense of measurement in is measurement in the sense of measurement in the physical sciences.the physical sciences.

► I discussed the fact that there are properties in I discussed the fact that there are properties in software measurement that are not satisfied in software measurement that are not satisfied in measurement in the physical sciences.measurement in the physical sciences.

► Since some properties of software Since some properties of software measurement are not satisfied in measurement measurement are not satisfied in measurement in the physical science, then one might have to in the physical science, then one might have to define a different foundation for software define a different foundation for software measurement. measurement.

Page 35: Weyuker Properties

► Thus, if we accept Weyuker’s Thus, if we accept Weyuker’s properties, we can see that software properties, we can see that software measurement does not have additive measurement does not have additive properties for some metric.properties for some metric.

► My research is similar to an earlier My research is similar to an earlier research by Resee (1943).research by Resee (1943).

Page 36: Weyuker Properties

ReferencesReferences

► [1] Jorge Cardoso. “Control flow Complexity [1] Jorge Cardoso. “Control flow Complexity Measurement of Processes and Weyuker’s Measurement of Processes and Weyuker’s Properties,” Preceedings of World Academy Properties,” Preceedings of World Academy of Science, Engineering and Technology of Science, Engineering and Technology Volume 8 October 2005 ISSN 1307-6884.Volume 8 October 2005 ISSN 1307-6884.

► [2] N. Fenton, “Software Metrics: A rigorous [2] N. Fenton, “Software Metrics: A rigorous Approach,” Chapman and Hall, London, Approach,” Chapman and Hall, London, 1991.1991.

► [3] N. Fenton, “Software Measurement: A [3] N. Fenton, “Software Measurement: A Necessary Scientific Basis,” IEEE Trans. Necessary Scientific Basis,” IEEE Trans. Software Eng., 20, 1994, pp. 199-206.Software Eng., 20, 1994, pp. 199-206.

Page 37: Weyuker Properties

► [4] P.N. Gedela, P. Kosaraju, and A. Melton, [4] P.N. Gedela, P. Kosaraju, and A. Melton, “Measurement Theory Principles in Software “Measurement Theory Principles in Software Measurement” May. 2007.Measurement” May. 2007.

► [5] McCabe, Thomas J. & Butler, Charles W. [5] McCabe, Thomas J. & Butler, Charles W. "Design Complexity Measurement and "Design Complexity Measurement and Testing." Testing." Communications of the ACM 32, Communications of the ACM 32, 12 12 (December 1989): 1415-1425.(December 1989): 1415-1425.

► [6] McCabe, Thomas J. & Watson, Arthur H. [6] McCabe, Thomas J. & Watson, Arthur H. "Software Complexity." "Software Complexity." Crosstalk, Journal of Crosstalk, Journal of Defense Software Engineering 7Defense Software Engineering 7, 12 , 12 (December 1994): 5-9.(December 1994): 5-9.

Page 38: Weyuker Properties

► [7] Thomas Reese. “The Application of the [7] Thomas Reese. “The Application of the theory of Physical Measurement to theory of Physical Measurement to Measurement of Psychological Magnitude Measurement of Psychological Magnitude with three experiments”. Psychological with three experiments”. Psychological

Monographs. Vol. 55:3, 251, 1943. pp. 6-20.Monographs. Vol. 55:3, 251, 1943. pp. 6-20.► [8] E. J. Weyuker, “Evaluating software [8] E. J. Weyuker, “Evaluating software

complexity measures,” IEEE Trans. Software complexity measures,” IEEE Trans. Software Eng., vol. 14, pp. 1357-1365, Sept. 1988.Eng., vol. 14, pp. 1357-1365, Sept. 1988.

► [9] H Zuse, “Software Complexity: [9] H Zuse, “Software Complexity: Measures and Methods”, Walter de Gruyter, Measures and Methods”, Walter de Gruyter, Berlin, 1990.Berlin, 1990.

Page 39: Weyuker Properties

QuestionsQuestions

Page 40: Weyuker Properties

►Thank You For Your TimeThank You For Your Time