1 / 57

SEA Side Software Engineering Annotations

SEA Side Software Engineering Annotations. Annotation11: Software Metrics One hour presentation to inform you of new techniques and practices in software development. Professor Sara Stoecklin Director of Software Engineering- Panama City Florida State University – Computer Science

chessa
Download Presentation

SEA Side Software Engineering Annotations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SEA SideSoftware Engineering Annotations Annotation11: Software Metrics One hour presentation to inform you of new techniques and practices in software development. Professor Sara Stoecklin Director of Software Engineering- Panama City Florida State University – Computer Science sstoecklin@mail.pc.fsu.edu stoeckli@cs.fsu.edu 850-522-2091 850-522-2023 Ex 182

  2. Metrics Express in Numbers Measurement provides a mechanism for objective evaluation

  3. Software Crisis • According to American Programmer, 31.1% of computer software projects get canceled before they are completed, • 52.7% will overrun their initial cost estimates by 189%. • 94% of project start-ups are restarts of previously failed projects. Solution?systematic approach to software developmentand measurement

  4. Software Metrics • It refers to a broad range of quantitative measurements for computer software that enable to • improve the software process continuously • assist in quality control and productivity • assess the quality of technical products • assist in tactical decision-making

  5. Measure, Metrics, Indicators • Measure. • provides a quantitative indication of the extent, amount, dimension, capacity, or size of some attributes of a product or process. • Metrics. • relates the individual measures in some way. • Indicator. • a combination of metrics that provide insight into the software process or project or product itself.

  6. What Should Be Measured? process process metrics project metrics measurement product metrics product What do we use as a basis? • size? • function?

  7. Metrics of Process Improvement • Focus on Manageable Repeatable Process • Use of Statistical SQA on Process • Defect Removal Efficiency

  8. Statistical Software Process Improvement All errors and defects are categorized by origin The overall cost in each category is computed The cost to correct each error and defect is recorded Resultant data are analyzed and the “culprit” category is uncovered No. of errors and defects in each category is counted and ranked in descending order Plans are developed to eliminate the errors

  9. Causes and Origin of Defects

  10. Metrics of Project Management • Budget • Schedule/ReResource Management • Risk Management • Project goals met or exceeded • Customer satisfaction

  11. Metrics of the Software Product • Focus on Deliverable Quality • Analysis Products • Design Product Complexity – algorithmic, architectural, data flow • Code Products • Production System

  12. How Is Quality Measured? • Analysis Metrics • Function-based Metrics: Function Points (Albrecht), Feature Points (C. Jones) • Bang Metric (DeMarco): Functional Primitives, Data Elements, Objects, Relationships, States, Transitions, External Manual Primitives, Input Data Elements, Output Data Elements, Persistent Data Elements, Data Tokens, Relationship Connections.

  13. Source Lines of Code (SLOC) • Measures the number of physical lines of active code • In general the higher the SLOC in a module the less understandable and maintainable the module is

  14. Function Oriented Metric - Function Points • Function Points are a measure of “how big” is the program, independently from the actual physical size of it • It is a weighted count of several features of the program • Dislikers claim FP make no sense wrt the representational theory of measurement • There are firms and institutions taking them very seriously

  15. Analyzing the Information Domain Unadjusted Function Points: Assuming all inputs with the same weight, all output with the same weight, … Complete Formula for the Unadjusted Function Points:

  16. Taking Complexity into Account Formula:

  17. Typical Function-Oriented Metrics • errors per FP (thousand lines of code) • defects per FP • $ per FP • pages of documentation per FP • FP per person-month

  18. LOC vs. FP • Relationship between lines of code and function points depends upon the programming language that is used to implement the software and the quality of the design • Empirical studies show an approximate relationship between LOC and FP

  19. LOC/FP (average) Assembly language 320 C 128 COBOL, FORTRAN 106 C++ 64 Visual Basic 32 Smalltalk 22 SQL 12 Graphical languages (icons) 4

  20. How Is Quality Measured? • Design Metrics • Structural Complexity: fan-in, fan-out, morphology • System Complexity: • Data Complexity: • Component Metrics: Size, Modularity, Localization, Encapsulation, Information Hiding, Inheritance, Abstraction, Complexity, Coupling, Cohesion, Polymorphism • Implementation Metrics Size, Complexity, Efficiency, etc.

  21. Comment Percentage (CP) • Number of commented lines of code divided by the number of non-blank lines of code • Usually 20% indicates adequate commenting for C or Fortran code • The higher the CP value the more maintainable the module is

  22. Size Oriented Metric - Fan In and Fan Out • The Fan In of a module is the amount of information that “enters” the module • The Fan Out of a module is the amount of information that “exits” a module • We assume all the pieces of information with the same size • Fan In and Fan Out can be computed for functions, modules, objects, and also non-code components • Goal - Low Fan Out for ease of maintenance.

  23. Size Oriented Metric - Halstead Software Science Primitive Measures number of distinct operators number of distinct operands total number of operator occurrences total number of operand occurrences Used to Derive maintenance effort of software testing time required for software

  24. Flow Graph if (a) { X(); } else { Y(); } Predicate Nodes a Y X • V(G) = E - N + 2 • where E = number of edges • and N = number of nodes

  25. McCabes Metric • Smaller the V(G) the simpler the module. • Modules larger than V(G) 10 are a little unmanageable. • A high cyclomatic complexity indicates that the code may be of low quality and difficult to test and maintain

  26. Chidamber and Kemerer Metrics • Weighted methods per class (MWC) • Depth of inheritance tree (DIT) • Number of children (NOC) • Coupling between object classes (CBO) • Response for class (RFC) • Lack of cohesion metric (LCOM)

  27. ci is the complexity of each method Mi of the class Often, only public methods are considered Complexity may be the McCabe complexity of the method Smaller values are better Perhaps the average complexity per method is a better metric? Weighted methods per class (WMC) The number of methods and complexity of methods involved is a direct predictor of how much time and effort is required to develop and maintain the class.

  28. Depth of inheritance tree (DIT) • For the system under examination, consider the hierarchy of classes • DIT is the length of the maximum path from the node to the root of the tree • Relates to the scope of the properties • How many ancestor classes can potential affect a class • Smaller values are better

  29. Number of children (NOC) • For any class in the inheritance tree, NOC is the number of immediate children of the class • The number of direct subclasses • How would you interpret this number? • A moderate value indicates scope for reuse and high values may indicate an inappropriate abstraction in the design

  30. Coupling between object classes (CBO) • For a class, C, the CBO metric is the number of other classes to which the class is coupled • A class, X, is coupled to class C if • X operates on (affects) C or • C operates on X • Excessive coupling indicates weakness of class encapsulation and may inhibit reuse • High coupling also indicates that more faults may be introduced due to inter-class activities

  31. Response for class (RFC) • Mci # of methods called in response to a message that invokes method Mi • Fully nested set of calls • Smaller numbers are better • Larger numbers indicate increased complexity and debugging difficulties If a large number of methods can be invoked in response to a message, the testing and debugging of the class becomes more complicated

  32. Lack of cohesion metric (LCOM) • Number of methods in a class that reference a specific instance variable • A measure of the “tightness” of the code • If a method references many instance variables, then it is more complex, and less cohesive • The larger the number of similar methods in a class the more cohesive the class is • Cohesiveness of methods within a class is desirable, since it promotes encapsulation

  33. Testing Metrics • Metrics that predict the likely number of tests required during various testing phases • Metrics that focus on test coverage for a given component

  34. Views on SE Measurement

  35. Views on SE Measurement

  36. Views on SE Measurement

  37. 12 Steps to Useful Software Metrics Step 1 - Identify Metrics Customers Step 2 - Target Goals Step 3 - Ask Questions Step 4 - Select Metrics Step 5 - Standardize Definitions Step 6 - Choose a Model Step 7 - Establish Counting Criteria Step 8 - Decide On Decision Criteria Step 9 - Define Reporting Mechanisms Step 10 - Determine Additional Qualifiers Step 11 - Collect Data Step 12 - Consider Human Factors

  38. Step 1 - Identify Metrics Customers ? Who needs the information? Who’s going to use the metrics? If the metric does not have a customer -- do not use it.

  39. Step 2 - Target Goals • Organizational goals • Be the low cost provider • Meet projected revenue targets • Project goals • Deliver the product by June 1st • Finish the project within budget • Task goals (entry & exit criteria) • Effectively inspect software module ABC • Obtain 100% statement coverage during testing

  40. Step 3 - Ask Questions Goal: Maintain a high level of customer satisfaction • What is our current level of customer satisfaction? • What attributes of our products and services are most important to our customers? • How do we compare with our competition?

  41. Metrics don’t solve problems -- people solve problems Metrics provide information so people can make better decisions Step 4 - Select Metrics Select metrics that provide information to help answer the questions • Be practical, realistic, pragmatic • Consider current engineering environment • Start with the possible

  42. Selecting Metrics Goal: Ensure all known defects are corrected before shipment

  43. understand evaluate control predict attribute of the entity in order to To the goal(s) in order to To the Metrics Objective Statement Template Example - Metric: % defects corrected ensure all known defects are corrected before shipment % defects found & corrected during testing evaluate

  44. Open User Step 5 - Standardize Definitions Open Developer

  45. Step 6 - Choose a Measurement Models for code inspection metrics • Primitive Measurements: • Lines of Code Inspected = loc • Hours Spent Preparing = prep_hrs • Hours Spent Inspecting = in_hrs • Discovered Defects = defects • Other Measurements: • Preparation Rate = loc / prep_hrs • Inspection Rate = loc / in_hrs • Defect Detection Rate = defects / (prep_hrs + in_hrs)

  46. Step 7 - Establish Counting Criteria Lines of Code • Variations in counting • No industry accepted standard • SEI guideline - check sheets for criteria • Advice: use a tool

  47. Counting Criteria - Effort What is a Software Project? • When does it start / stop? • What activities does it include? • Who works on it?

  48. Step 8 - Decide On Decision Criteria Establish Baselines • Current value • Problem report backlog • Defect prone modules • Statistical analysis (mean & distribution) • Defect density • Fix response time • Cycle time • Variance from budget (e.g., cost, schedule)

  49. Step 9 - Define Reporting Mechanisms

  50. Step 10 - Determine Additional Qualifiers A good metric is a generic metric Additional qualifiers: • Provide demographic information • Allow detailed analysis at multiple levels • Define additional data requirements

More Related