Complexity Metrics and Models
Software Quality Management Unit – IV G. Roy Antony Arnold Asst. Prof. /CSEh li f d ( OC) i ll f • The lines of code LOC) count is usually for executable statements. • LOC count represents the program size and complexity, it is not a surprise that . • More recent studies point to a curvilinear relationship between lines of code and defect rate:Maximum Source Lines of Modules Average Defect per 1,000 Source Lines 63 1.5 100 1.4 158 0.9 251 0.5 398 1.1 630 1.9 1000 1.3 >1000 1.4Wh d l i b l h • When module size becomes very large, the complexity increases to a level beyond a programmer's immediate span of control and total programmer s comprehension. • The curvilinear model between size and defect density sheds new light on software quality engineering. It implies that there may be an g g p y optimal program size that can lead to the lowest defect rate. • Such an optimum may depend on language, project, product, and environment; apparently i i li ti ti d d many more empirical investigations are needed.• Halstead (1977) distinguishes software science from computer science. • The premise of software science is that any programming task consists of selecting and arranging a finite number of program “tokens” which are tokens , . di f • A computer program, according to software science, .Th i iti f H l t d' ft i • The primitive measures of Halstead's software science are • Based on these primitive measures, Halstead developed a system of equations expressingand other features such as development effort and the projected number of faults in the software.Vocabulary, Length, Volume, Level, Difficulty Difficulty, Effort, Faults, h f l i l i b • The measurement of cyclomatic complexity by McCabe (1976) was designed (maintainability). • It is the classical graph theory cyclomatic number,. • To determine the paths, the program procedure is represented .• The general formula to compute cyclomatic complexity is: p y Wh • Where, V(G) – Cyclomatic Number of G ( ) y e – Number of edges n Number nodes – of p – Number of unconnected parts of the graph• If we count the edges, nodes, and disconnected parts of the graph, • The iteration test in a looping statement is counted as one binary decision. In the preceding simple example, since there are two binary decisions, M = 2 + 1 = 3 • The cyclomatic complexity metric is additive The of several additive. complexity graphs considered as a group is equal to the sum of the individual graphs' complexities. g p pneeding detailed inspections. g p likely to have a defect and therefore low rate candidates for development without l detailed inspections. , identify troublesome code, and estimate effort testing effort.• McCabe's cyclomatic complexity index is a . • It does not distinguish different kinds of control flow complexity such as p y . • In studying the quality and syntactic indicators among a sample of twenty modules of a COBOL compiler product found that product, at the module level can be estimated through the following equations: • Lo found that most developers were having difficulty p g y mastering the DO WHILE construct. • As a result, minimizing the use of DO WHILE was one of the actions the team took to reduce defects in the compiler product.St t t i t t t k i t t th • Structure metrics try to take into account the . • The most common design structure metrics are the which are , based on the proposed by (1979) and (1978): A count of the modules that call a given module : A count of modules that are called by a given module I l d l ith l f i • In general, modules with a large fan‐in are . • In contrast, modules that are large and complex are likely to have a small fan‐in. structure complexity is defined as: • Henry and Selig's work (1990) defines a hybrid form of their information‐flow metric as information where, Cip – internal complexity of procedure p C d d Gl (1990) d l d t l it d l • Card and Glass developed a system complexity model C – System Complexity S – Structural (intermodule) Ct Complexity, St complexity, Dt – Data (intermodule) complexity • They defined relative system complexity as n – no. Of modules in the system S l i i f h d fi d • Structure complexity is further defined as i f S ∑ = ) ( 2 Where S – Structural Complexity, f(i) – Fan‐out of Module i, n n – no. Of modules in the systemD t C l it i f th d fi d • Data Complexity is further defined as Di – Data Complexity of Module i, V(i) – I/O Variables in module i, f(i) – fan‐out of module i D – Data (intramodule) Complexity, D(i) – Data Complexity of module i, n = Number of new modules in the system
Description
Anna University, B.E. CSE, Final Year, Software Quality Management
Introduction to Complexity Metrics and Models
Anna University, B.E. CSE, Final Year, Software Quality Management
Introduction to Complexity Metrics and Models
Anna University, B.E. CSE, Final Year, Software Quality Management
Introduction to Complexity Metrics and Models
Anna University, B.E. CSE, Final Year, Software Quality Management
Introduction to Complexity Metrics and Models
Presentation Transcript
Your Facebook Friends on WizIQ