CS223: Software Engineering

Slides:



Advertisements
Similar presentations
Figures – Chapter 24.
Advertisements

Software Metrics II Speaker: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001.
Object-Oriented Metrics
1 Complexity metrics  measure certain aspects of the software (lines of code, # of if-statements, depth of nesting, …)  use these numbers as a criterion.
Object Oriented Metrics XP project group – Saskia Schmitz.
Comp 587 Parker Li Bobby Kolski. Automated testing tools assist software engineers to gauge the quality of software by automating the mechanical aspects.
Cyclomatic Complexity Dan Fleck Fall 2009 Dan Fleck Fall 2009.
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
1 Software Quality CIS 375 Bruce R. Maxim UM-Dearborn.
Software Measurement & Metrics
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 15b: Product Metrics for Software Software Engineering: A Practitioner’s Approach, 6/e Chapter.
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.
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.
Software Quality Metrics
Concepts of Software Quality Yonglei Tao 1. Software Quality Attributes  Reliability  correctness, completeness, consistency, robustness  Testability.
Chapter 12: Design Phase n 12.1 Design and Abstraction n 12.2 Action-Oriented Design n 12.3 Data Flow Analysis n Data Flow Analysis Example n
Software Design Design is the process of applying various techniques and principles for the purpose of defining a device, a process,, or a system in sufficient.
1 Metrics and lessons learned for OO projects Kan Ch 12 Steve Chenoweth, RHIT Above – New chapter, same Halstead. He also predicted various other project.
CSc 461/561 Information Systems Engineering Lecture 5 – Software Metrics.
Software Metrics.
Measurement and quality assessment Framework for product metrics – Measure, measurement, and metrics – Formulation, collection, analysis, interpretation,
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.
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.
Object Oriented Metrics
Software Engineering Lecture 19: Object-Oriented Testing & Technical Metrics.
Cyclomatic complexity (or conditional complexity) is a software metric (measurement). Its gives the number of indepented paths through strongly connected.
Software Engineering Object Oriented Metrics. Objectives 1.To describe the distinguishing characteristics of Object-Oriented Metrics. 2.To introduce metrics.
CS223: Software Engineering Lecture 21: Unit Testing Metric.
1 Week 7 Software Engineering Spring Term 2016 Marymount University School of Business Administration Professor Suydam.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
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
Object Oriented Metrics
CompSci 280 S Introduction to Software Development
A Hierarchical Model for Object-Oriented Design Quality Assessment
Assessment of Geant4 Software Quality
Software Metrics 1.
Software Testing.
Introduction to the C Language
Course Notes Set 12: Object-Oriented Metrics
Cyclomatic complexity
Design Characteristics and Metrics
Halstead’s software science: An analystical model
CPSC 873 John D. McGregor GQM.
About the Presentations
Object-Oriented Metrics
Design Metrics Software Engineering Fall 2003
Design Metrics Software Engineering Fall 2003
Lecture 17 Software Metrics
Introduction to the C Language
Information flow-Test coverage measure
Software Testing (Lecture 11-a)
Chapter 14 Software Testing Techniques
Algorithm An algorithm is a finite set of steps required to solve a problem. An algorithm must have following properties: Input: An algorithm must have.
Objective of This Course
Halstead software science measures and other metrics for source code
COCOMO Models.
Information Flow Metric
Presented by Trey Brumley and Ryan Carter
Chapter 19 Technical Metrics for Software
Software Metrics SAD ::: Fall 2015 Sabbir Muhammad Saleh.
Software Testing “If you can’t test it, you can’t design it”
1. Cyclomatic complexity
Chapter 8: Design: Characteristics and Metrics
Presentation transcript:

CS223: Software Engineering Measuring Functionality

Function Point Analysis Function Point Analysis (FPA) was invented as an indirect measure for the functional size of a system.

Problem Assume you work for a company that currently makes home safety and security monitoring devices and controllers. Now your company wants to sell home safety systems. You need to design and build the software part of the system. The available components are: Controller (with associated monitoring devices) for door and window alarms Controller (with associated monitoring devices) for motion detectors Controller (with associated monitoring devices) for panic buttons Controller (with associated monitoring devices) for fire detector Controller (with associated devices) for light activator and deactivator Controller/monitor for key device (to turn system on and off) Wireless dial-out device with controller Estimate the effort to build the system. Assume a productivity of 10 FPs per staff month, with a standard deviation of ±1 staff month.

Home security architecture

Solution (One Approach) Input Output Database Type of complexity Calculate UFP VAF AFPs = UFPs(0.65+0.01*VAF) Effort = AFPs/ Productivity

Extension to the problem Now you are told that your company can only afford 75% of the estimated staff months to build the system. What do you do now?

Pros and Cons Technology Independent, Effective Early (Requirements Phase) In The Software Life Cycle, Well-documented And Specified, Supported By Standards And An International Users Group, Backed By Substantial Data That Supports The Methodology, Reasonably Reliable And Accurate,

Cyclomatic Complexity McCabe’s cyclomatic complexity (CC), which is a measure of the number of control flows within a module The greater the number of paths through a module, the higher the complexity Cyclomatic number of a graph, denoted by V(g), by counting the number of linearly independent paths within a program Allows you to also determine the minimum number of unique tests that must be run to execute every executable statement. V(g) = e – n + 2 V(g) = bd + 1 If there is a n-way decision, it is counted as n-1 binary decisions

Example

Exercise char *strncat(char *dest, const char *src, size_t count) { / * The strncat() function appends up to count characters from string src to string dest, and then appends a terminating null character. If copying takes place between objects that overlap, the behavior is undefined. * / char *strncat(char *dest, const char *src, size_t count) { char *temp=dest; if (count) { while (*dest) dest++; while ((*dest++=*src++)) { if (--count==0) { *dest=‘\0’; break; } } return temp;

Cyclomatic Complexity Recommendations

Halstead’s Metrics Halstead introduced complexity metrics based on the number of operators and operands in a program He developed equations for difficulty, effort, and volume, which he called “software science.” Operands were tokens with a value, such as variables and constants. Operators were everything else, including commas, parentheses, and arithmetic operators.

Metrics Halstead’s metrics are defined as: Length: N= N1 + N2 Vocabulary: n = n1 + n2 Volume: V = N(log2 (n)) Difficulty: D = (n1/2) * (N2/n2) Effort: E = D * V

Determining operators and operands The determination of the number of operators is neither completely clear nor unambiguous. One working definition is that operands are variables, constants, and strings, and operators are everything else. Operators that are paired (such as while do or {}) only count as one. Again, it is typically more important to decide how you will count and to be consistent, rather than worrying about the details of the specific rules.

Exercise char *strncat(char *dest, const char *src, size_t count) { / * The strncat() function appends up to count characters from string src to string dest, and then appends a terminating null character. If copying takes place between objects that overlap, the behavior is undefined. * / char *strncat(char *dest, const char *src, size_t count) { char *temp=dest; if (count) { while (*dest) dest++; while ((*dest++=*src++)) { if (--count==0) { *dest=‘\0’; break; } } return temp;

Information Flow Metrics Information flow metrics measure the information flow into and out of modules The underlying theory is that a high amount of information flow indicates a lack of cohesion in the design, which causes higher complexity Information Flow Complexity (IFC) = (fanin * fanout)2 Fanin = number of local flows into a module plus the number of data structures that are used as input. Fanout = number of local flows out of a module plus the number of data structures that are used as output

IEEE 982.2 IFC = (fanin * fanout)2 Weighted IFC = length * (fanin * fanout)2 Fanin = local flows into a procedure + number of data structures from which the procedure retrieves data Fanout = local flows from a procedure + number of data structures that the procedure updates Length = number of source statements in a procedure (excluding comments in a procedure)

Local flow between procedures A local flow between procedures A and B exists if: A calls B B calls A and A returns a value to B that is used by B Both A and B are called by another module (procedure) that passes a value from A to B High information complexity of a procedure may indicate: More than one function (lack of cohesion) A potential choke point for the system (too much information traffic) Excessive functional complexity (lack of cohesion) A good candidate for redesign/simplification or extensive testing

Exercise IFC = 𝟑 ∗ 𝟏 𝟐 = 𝟗 Weighted IFC = 𝟏𝟎∗ 𝟑 ∗ 𝟏 𝟐 = 𝟗𝟎 / * The strncat() function appends up to count characters from string src to string dest, and then appends a terminating null character. If copying takes place between objects that overlap, the behavior is undefined. * / char *strncat (char *dest, const char *src, size_t count){ char *temp=dest; if (count) { while (*dest) dest++; while ((*dest++=*src++)) { if (--count==0) { *dest=‘\0’; break; } return temp; IFC = 𝟑 ∗ 𝟏 𝟐 = 𝟗 Weighted IFC = 𝟏𝟎∗ 𝟑 ∗ 𝟏 𝟐 = 𝟗𝟎

Object-Oriented Design Metrics OOD programs are structurally different OOD programs are structured around objects, which encapsulate the state, the characteristics, and the possible set of actions for that object We would like them to measure classes, modularity, encapsulation, inheritance, and abstraction Chidamber and Kemerer (CK) metrics

CK Metric WMC—Weighted Methods per Class the number of methods per class DIT—Depth of Inheritance Tree how many inheritance layers make up a given class hierarchy NOC—Number of Children number of immediate successors of the class CBO—Coupling Between Object Classes how many other classes rely on the class and vice versa RFC—Response for Class It is calculated as the sum of the number of methods plus the number of methods called by local methods LCOM—Lack of Cohesion on Methods number of different methods within a class that reference a given instance variable

//Initiate an instance IEEval of class ESieveEval public class ESieveEval implements IEEval{ private EFilterEval EFilterEval; private integer newVal=new Integer(2); //initiate the class ESieveEval public ESieveEval() { LRStruct src=(new EIncEval(2,1)).makeELRS (); // src=2,3,4,5,. . EFilterEval¼new EFilterEval(newVal, src); //filter out numbers } //inherit predefined class LRStruct, public LRStruct nextLRS() { newVal=(Integer)EFilterEval.nextLRS().getFirst(); EFilterEval= new EFilterEval (newVal, EFilterEval.makeELRS ()); return makeELRS(); //use the design pattern Singleton to define method makeELRS() public LRStruct makeELRS() { return LRSFactory.Singleton().makeLRS (newVal, this);

Thank you Next Lecture: Software Quality