Halstead software science measures and other metrics for source code

Slides:



Advertisements
Similar presentations
Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Advertisements

Evaluation of Abstraction Techniques. Uses for the complexity metrics in our framework Comparing the complexity of the reference model with the abstracted.
Chapter 6 Path Testing Software Testing
1 Ivan Marsic Rutgers University LECTURE 15: Software Complexity Metrics.
CYCLOMATIC COMPLEXITY 1. Invented by Thomas McCabe (1974) to measure the complexity of a program ’ s conditional logic Cyclomatic complexity of graph.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Software engineering for real-time systems
Software Metrics II Speaker: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001.
 2006 Pearson Education, Inc. All rights reserved Control Statements: Part 2.
1 Complexity metrics  measure certain aspects of the software (lines of code, # of if-statements, depth of nesting, …)  use these numbers as a criterion.
COMP 6710 Course NotesSlide 11-0 Auburn University Computer Science and Software Engineering Course Notes Set 11: Software Metrics Computer Science and.
Unit Testing CS 414 – Software Engineering I Don Bagert Rose-Hulman Institute of Technology January 16, 2003.
Overview Software Quality Metrics Black Box Metrics White Box Metrics
A Complexity Measure THOMAS J. McCABE Presented by Sarochapol Rattanasopinswat.
Cyclomatic Complexity Dan Fleck Fall 2009 Dan Fleck Fall 2009.
Software Reliability Model Deterministic Models Probabilistic Models Halstead’s software metric McCabe’s cyclomatic complexity metrix Error seeding Failure.
University of Toronto Department of Computer Science © 2001, Steve Easterbrook CSC444 Lec22 1 Lecture 22: Software Measurement Basics of software measurement.
Software Metrics.
Lecture 17 Software Metrics
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Software Metrics Software Engineering.
Agenda Introduction Overview of White-box testing Basis path testing
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Lecture 23 Instructor Paulo Alencar.
Software Metrics (Part II). Product Metrics  Product metrics are generally concerned with the structure of the source code (example LOC).  Product metrics.
White-box Testing.
BASIS PATH TESTING.
Creator: ACSession No: 7 Slide No: 1Reviewer: SS CSE300Advanced Software EngineeringSeptember 2005 Software Measurement – Estimation and Productivity CSE300.
Measure18 1 Software Measurement Halstead’s Software Science.
Software Metrics.
1 Control Flow Analysis Topic today Representation and Analysis Paper (Sections 1, 2) For next class: Read Representation and Analysis Paper (Section 3)
Theory and Practice of Software Testing
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Metrics "A science is as mature as its measurement tools."
White Box Testing by : Andika Bayu H.
Cyclomatic complexity (or conditional complexity) is a software metric (measurement). Its gives the number of indepented paths through strongly connected.
Martin Hoffman Monica Hoffman. Goal To determine if a correlation exists between specified internal and dependability (external) metrics.
 2006 Pearson Education, Inc. All rights reserved Control Statements: Part 2.
Cyclomatic Complexity Philippe CHARMAN Last update:
CS223: Software Engineering Lecture 21: Unit Testing Metric.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Software METRICS. Intro Measurement is essential to life economic measurement... clinical measurement... air traffic control... etc., etc., etc....
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,
Static Software Metrics Tool
BASIS PATH TESTING.
Software Metrics 1.
Software Testing.
Design Characteristics and Metrics
Software metric By Deepika Chaudhary.
Halstead’s software science: An analystical model
Software Engineering (CSI 321)
CPSC 873 John D. McGregor GQM.
Data Coverage and Code Coverage
Structural testing, Path Testing
White Box Testing.
Expressions and Control Flow in JavaScript
Celia Chen1, Lin Shi2, Kamonphop Srisopha1
Lecture 17 Software Metrics
11/10/2018.
Information flow-Test coverage measure
Chapter 14 Software Testing Techniques
CS223: Software Engineering
Code Optimization Overview and Examples Control Flow Graph
Information Flow Metric
Presented by Trey Brumley and Ryan Carter
Coupling Interaction: It occurs due to methods of a class invoking methods of other classes. Component Coupling: refers to interaction between two classes.
1. Cyclomatic complexity
Chapter 8: Design: Characteristics and Metrics
Unit III – Chapter 3 Path Testing.
Presentation transcript:

Halstead software science measures and other metrics for source code V. Kubera Samrat

Why ? Drawbacks in LOC It is programming language dependent. Poor software design may lead to excessive and unnecessary line of code. It treats all the lines alike.

Token It is defined as either operator or operand in the program. Generally any symbol or keyword in a program that specifies algorithmic action is called an operator. eg: +/-*,while A symbol used to represent data are called as operands. eg: variables, constants, labels etc.,

Halstead metric M.H. Halstead proposed this metric The measures are: Using primitive measures Derived once the design phase is complete and code is generated. The measures are: n1= number of distinct operators in a program n2= number of distinct operands in a program N1= total numbers of operators N2= total number of operands By using these measures, Halstead developed an expression for overall program length, program volume, program difficulty, development effort

Contd., Program length (N) can be calculated by using equation: N = n1log2 n1 + n2log2 n2 Program volume (V) can be calculated by using equation: V = N log2(n1+n2) Volume ratio (L) can be calculated by using the following equation: L=(Volume of most compact program)/(volume of actual program) L = (2/n1 )* (n2/N2 ) Program difficulty level (D) and effort(E) can be calculated by equations: D = (n1/2)*(N2/n2) E = D * V

General Counting rules for C-Program Comments are not considered The identifiers and function declarations are not considered All the Hash directives are ignored. All the variables and constants are considered as operands. Global variables used in different modules are considered as multiple occurrences of same variable Local variables in different functions are considered as unique operands.

Contd., Function calls are considered as operators. All looping statements and all control statements are considered as operators. In control construct switch, both switch and cases are considered as operators. The reserve words like return, default etc., are considered as operators All the braces, commas and terminators are operators GOTO is counted as operator and label is treated as operand In the array variables such as array-name[index], array-name and index are treated as operands and [ ] is treated as operator and so on………………..,

McCabe's Cyclomatic Complexity V(G) It is logical metrics for source code. Uses a Program Control Graph Basis for McCabe's metric Measure of complexity is number of different paths through the program control graph Number of basic paths (all paths composed of basic paths) Cyclomatic Number is the number of basic paths. V(G) = Cyclomatic Complexity = edges - nodes + connected parts/no of exits

Information flow metrics This metric was first proposed by Katura and Henry It is logical metric used to find the complexity of software module. The complexity in information flow metric is determined by : C = (Procedure Length) * (Fan-In * Fan-Out) (Fan-In * Fan-Out) Where, C – The complexity of the module Procedure Length – The length of the module, given in LOC or by using Mccabe’s cyclomatic complexity. Fan-In – The number of calls to the module Fan-Out – The number of calls from the module.