COMP 6710 Course NotesSlide 11-0 Auburn University Computer Science and Software Engineering Course Notes Set 11: Software Metrics Computer Science and.

Slides:



Advertisements
Similar presentations
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Advertisements

Metrics for Process and Projects
Metrics for Process and Projects
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Software Metrics.
Metrics Project and Process Metrics. Why do we measure? Assessing project status Allows us to track risks Before they go critical Adjust workflow See.
Software Engineering II - Topic: Software Process Metrics and Project Metrics Instructor: Dr. Jerry Gao San Jose State University
Software Metrics II Speaker: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001.
Ch8: Management of Software Engineering. 1 Management of software engineering  Traditional engineering practice is to define a project around the product.
Project Management Metrics.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Testing an individual module
Unit Testing CS 414 – Software Engineering I Don Bagert Rose-Hulman Institute of Technology January 16, 2003.
Software Process and Product Metrics
Software Metric capture notions of size and complexity.
University of Toronto Department of Computer Science © 2001, Steve Easterbrook CSC444 Lec22 1 Lecture 22: Software Measurement Basics of software measurement.
Cmpe 589 Spring Software Quality Metrics Product  product attributes –Size, complexity, design features, performance, quality level Process  Used.
1 Software Quality CIS 375 Bruce R. Maxim UM-Dearborn.
Software Engineering Software Process and Project Metrics.
Chapter 6 : Software Metrics
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Software cost estimation Predicting the resources required for a software development process 1.
Product Metrics An overview. What are metrics? “ A quantitative measure of the degree to which a system, component, or process possesses a given attribute.”
Software Metrics Software Engineering.
Agenda Introduction Overview of White-box testing Basis path testing
1 Chapter 23 Estimation for Software Projects. 2 Software Project Planning The overall goal of project planning is to establish a pragmatic strategy for.
Software Engineering SM ? 1. Outline of this presentation What is SM The Need for SM Type of SM Size Oriented Metric Function Oriented Metric 218/10/2015.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Lecture 23 Instructor Paulo Alencar.
Software Function, Source Lines Of Code, and Development Effort Prediction: A Software Science Validation ALLAN J. ALBRECHT AND JOHN E.GAFFNEY,JR., MEMBER,IEEE.
Software Project Management Lecture # 3. Outline Chapter 22- “Metrics for Process & Projects”  Measurement  Measures  Metrics  Software Metrics Process.
OHTO -99 SOFTWARE ENGINEERING “SOFTWARE PRODUCT QUALITY” Today: - Software quality - Quality Components - ”Good” software properties.
Software Metrics (Part II). Product Metrics  Product metrics are generally concerned with the structure of the source code (example LOC).  Product metrics.
Software Quality Metrics
Software Metrics – part 2 Mehran Rezaei. Software Metrics Objectives – Provide State-of-art measurement of software products, processes and projects Why.
Lecture 4 Software Metrics
Software Engineering 2 Software Testing Claire Lohr pp 413 Presented By: Feras Batarseh.
Chapter 3: Software Project Management Metrics
SOFTWARE PROCESS AND PROJECT METRICS. Topic Covered  Metrics in the process and project domains  Process, project and measurement  Process Metrics.
Software Metrics.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 15a: Product Metrics for Software Software Engineering: A Practitioner’s Approach, 6/e Chapter.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Hussein Alhashimi. “If you can’t measure it, you can’t manage it” Tom DeMarco,
Advanced Software Engineering Lecture 4: Process & Project Metrics.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Chapter 22 Metrics for Process and Projects Software Engineering: A Practitioner’s Approach 6 th Edition Roger S. Pressman.
Metrics "A science is as mature as its measurement tools."
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
CS223: Software Engineering Lecture 21: Unit Testing Metric.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Testing Integral part of the software development process.
Software Test Metrics When you can measure what you are speaking about and express it in numbers, you know something about it; but when you cannot measure,
Chapter 33 Estimation for Software Projects
Software Metrics 1.
Software Testing.
Software metric By Deepika Chaudhary.
Software Engineering (CSI 321)
Software Engineering (CSI 321)
Software Project Sizing and Cost Estimation
Software Engineering: A Practitioner’s Approach, 6/e Chapter 23 Estimation for Software Projects copyright © 1996, 2001, 2005 R.S. Pressman & Associates,
Chapter 14 Software Testing Techniques
Halstead software science measures and other metrics for source code
Software Metrics “How do we measure the software?”
Chapter 33 Estimation for Software Projects
Software metrics.
Software Engineering: A Practitioner’s Approach, 6/e Chapter 23 Estimation for Software Projects copyright © 1996, 2001, 2005 R.S. Pressman & Associates,
Metrics for Process and Projects
Chapter 26 Estimation for Software Projects.
By: Lecturer Raoof Talal
Presentation transcript:

COMP 6710 Course NotesSlide 11-0 Auburn University Computer Science and Software Engineering Course Notes Set 11: Software Metrics Computer Science and Software Engineering Auburn University

COMP 6710 Course NotesSlide 11-1 Auburn University Computer Science and Software Engineering Software Metrics Software metrics is a broad area of research. Essentially refers to the measurement of certain attributes of a software: [Pressman] –Process Give insight into what works and what doesn’t in the process (e.g., the model, tasks, milestones, etc.). The goal is long-term process improvement. –Project Give insight into the status of an ongoing project, track potential risks, identify problems earlier, adjust workflow and tasks, evaluate the project team’s ability to control quality. The goal is to keep a project on schedule and within quality boundaries. –Product Give insight into internal characteristics of the product such as appropriateness of of analysis, design, and code models, the effectiveness of test cases, and the overall product quality.

COMP 6710 Course NotesSlide 11-2 Auburn University Computer Science and Software Engineering Software Metrics Measure - a datum that is a quantification of a software attribute Measurement - the collection of one or more measures Metric - a relation of the individual measures in a meaningful way Indicator - a metric or combination of metrics that provide insight which enables process, project, or product improvement. Example: –Measures = # tokens in a statement, # of conditions in an IF, level of nesting –Metric = complexity [Pressman 4th Ed]

COMP 6710 Course NotesSlide 11-3 Auburn University Computer Science and Software Engineering Software Metrics A measurement process –Derive and formulate appropriate metrics. –Collect the necessary data. –Compute the metrics. –Interpret the metrics. –Evaluate the product in light of the metrics.

COMP 6710 Course NotesSlide 11-4 Auburn University Computer Science and Software Engineering Software Quality Metrics In any assessment of software quality, some form of measurement must occur. The measurement may be –Direct (errors per KLOC) –Indirect (usability) Various taxonomies of “quality factors” have been proposed: –McCall, et al. –FURPS (Functionality, Usability, Reliability, Performance, Supportability) No matter the taxonomy or method of measurement, no real measurement of quality ever occurs; only surrogates can ever be measured. A fundamental problem is identifying appropriate surrogates to serve as indicators of software quality.

COMP 6710 Course NotesSlide 11-5 Auburn University Computer Science and Software Engineering A Few Measures and Metrics Lines of code (LOC) Function Points (FP) Reliability Metrics Complexity Metrics –Halstead Metrics –McCabe Metrics –Complexity Profile Graph

COMP 6710 Course NotesSlide 11-6 Auburn University Computer Science and Software Engineering Lines of Code (LOC) Direct measurement Can be used as a productivity indicator (e.g. KLOC per person) Can be used as the basis of quality indicators (e.g. errors per KLOC) Positive –Easily measured and computed. –Guaranteed measurable for all programs. Negative –What to count? Is this count language-independent? –Better suited to procedural languages than non-procedural ones. –Can it devalue shorter, but better-design programs?

COMP 6710 Course NotesSlide 11-7 Auburn University Computer Science and Software Engineering A Partial List of Size Metrics number of lines in the source file number of language statements in the source file number of semicolons in the source file Halstead’s length, vocabulary, and volume number of bytes in the source file number of bytes in the object file number of machine code instructions number of comments number of nodes in the parse tree length of longest branch in the parse tree

COMP 6710 Course NotesSlide 11-8 Auburn University Computer Science and Software Engineering Function Points (FP) Subjective, indirect measure To be measured early in the life cycle (e.g. during requirements analysis), but can be measured at various points. Measures the functionality of software, with the intent of estimating a project’s size (e.g., Total FP) and monitoring a project’s productivity (e.g., Cost per FP, FP per person-month) Developed at IBM and rooted in classic information systems applications Software Productivity Research, Inc. (SPR) developed a FP superset known as “Feature Points” to incorporate software that is high in algorithmic complexity but low in input/output. A program’s FP metric is computed based on the program’s information domain and functionality complexity, with empirically-derived weighting factors.

COMP 6710 Course NotesSlide 11-9 Auburn University Computer Science and Software Engineering Function Points The FP metric is computed by considering five factors which directly impact the visible, external aspects of software: –Inputs to the application –Outputs generated by the application –User inquiries –Data files to be accessed by the application –Interfaces to other applications Initial trial and error produced empirical weights for each of the five items along with a complexity adjustment for the overall application. –The weights reflect the approximate difficulty associated with implementing each of the five factors. –The complexity adjustment reflects the approximate overall level of complexity of the application (e.g.: Is distributed processing involved? Is data communications involved? etc.)

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering FP Counting Method (Original)

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering FP Counting Example

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Complexity Metrics Not a measure of computational complexity Measures psychological complexity, specifically structural complexity; that is, the complexity that arises from the structure of the software itself, independent of any cognitive issues. Many complexity metrics exist: H. Zuse lists over 200 in his 1990 taxonomy. Complexity metrics can be broadly categorized according to the fundamental software attribute measures on which they are based: –software science parameters –control-flow –data-flow –information-flow –hybrid

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Halstead Metrics Software Science is generally agreed to be the beginning of systematic research on metrics as predictors for qualitative attributes of software. Proposed by Maurice Halstead in 1972 as a mixture of information theory, psychology, and common sense. These are linguistic metrics. Based on four measures of two fundamental software attributes, operators and operands: –n 1 - number of unique operators –n 2 - number of unique operands –N 1 - total number of operators –N 2 - total number of operands

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Halstead Metrics Halstead conjectures relationships between these fundamental measures and a variety of qualitative attributes: –Length: N = N 1 + N 2 –Vocabulary: n = n 1 + n 2 –Volume: V = N*lg(n) –Level: L = (2*n 2 )/(n 1 N 2 ) –Difficulty: D = 1/L –Effort: E = V * D Halstead also defines a number of other attributes: –potential volume, intelligence content, program purity, language level, predicted number of bugs, predicted number of seconds required for implementation

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Halstead Metrics Extensive experiments involving Halstead metrics have been done and the metrics generally hold up well. –Even the bug prediction metric has been supported: A study of various programs ranging in size from 300 to 12,000 executable statements suggested that the bug prediction metric was accurate to within 8%. [Lipow, M. IEEE TSE, 8: (1982)] Generally used as maintenance metrics. A few caveats: –Operator/Operand ambiguity Is code always code and data always data? –Operator types Some control structures are inherently more complex than others. –Level of nesting Nesting adds complexity to code.

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering McCabe Metrics Tom McCabe was the first to propose that complexity depends only on the decision structure of a program and is therefore derivable from a control flow graph. In this context, complexity is a synonym for testability and structuredness. McCabe’s premise is that the complexity of a program is related to the difficulty of performing path testing. These are structural metrics. McCabe metrics are a family of related metrics including: –Cyclomatic Complexity –Essential Complexity –Module Design Complexity –Design Complexity –Pathological Complexity

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Cyclomatic Complexity Cyclomatic Complexity, v(G), is a measure of the amount of control structure or decision logic in a program. Studies have shown a high correlation between v(G) and the occurrence of errors and it has become a widely accepted indicator of software quality. Based on the flowgraph representation of code: –Nodes - representing one or more procedural statements –Edges - the arrows represent flow of control –Regions - areas bounded by edges and nodes; includes the area outside the graph Cyclomatic Complexity is generally computed as: –v(G) = number of regions in the flowgraph –v(G) = number of conditions in the flowgraph + 1 –v(G) = number of edges - number of nodes + 2

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Cyclomatic Complexity Cyclomatic complexity can be used to –Determine the maximum number of test cases to ensure that all independent paths through the code have been tested. –Ensure the code covers all the decisions and control points in the design. –Determine when modularization can decrease overall complexity. –Determine when modules are likely to be too buggy.

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Cyclomatic Complexity Thresholds 1-10 –A simple module, without much risk –More complex, moderate risk –Complex, high risk Greater than 50 –Untestable, very high risk [From SEI reports]

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Complexity Profile Graph Algorithmic level graph of complexity profile Fine-grained metric –for each production in the grammar Profile of program unit rather than single- value metric Complexity values from each measurable unit in a program unit are displayed as a set to form the complexity profile graph. Adds the advantages of visualization to complexity measurement.

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Complexity Profile Graph A program unit is parsed and divided into segments –e.g., each simple declaration or statement is a single segment, composite statements are divided into multiple segments Each segment is a measurable unit. Segments are non-overlapping and all code is covered –i.e., all tokens are included in exactly one segment The complexity for each segment is a bar in the CPG.

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Complexity Profile Graph

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Computing the CPG Content –C = ln(reserved words + operators + operands) Breadth –B = number of statements within a construct Reachability –R = 1 + number of operators in predicate path Inherent –I = assigned value based on type of control structure Total –T = s 1 C + s 2 B + s 3 R + s 4 I –where s 1, s 2, s 3, s 4 are scaling factors

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Maintainability Index Quantitative measurement of an operational system’s maintainability, developed by industry (Hewlett- Packard, and others) and research groups (Software Engineering Test Laboratory at University of Idaho, and others). A combination of Halstead metrics, McCabe metrics, LOC, and comment measures. MI formula calibrated and validated with actual industrial systems. Used as both an instantaneous metric as well as a predictor of maintainability over time. MI measurement applied during software development can help reduce lifecycle costs. [From SEI reports]

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering MI Formula 171 – 5.2*ln(aveV) – 0.23*aveV(g’) *ln(aveLOC) – 50*sin(sqrt(2.4*perCM)) Where: aveV = average Halstead volume V per module aveV(g’) = average cyclomatic complexity per module aveLOC = average LOC per module perCM = average percent of comment lines per module [From SEI reports]

COMP 6710 Course NotesSlide Auburn University Computer Science and Software Engineering Using the MI Systems can be checked periodically for maintainability. MI can be integrated into development to evaluate code quality as it is being built. MI can be used to assess modules for risk as candiates for modification. MI can be used to compare systems with each other. [From SEI reports]