chapter 12 defects. 山东大学计算机学院 2 in the chapter concept of defects defects and...

36
Chapter 12 Defects

Upload: oliver-oliver

Post on 29-Dec-2015

251 views

Category:

Documents


9 download

TRANSCRIPT

  • Chapter 12 Defects

  • In the chapterConcept of DefectsDefects and software qualityWhat is Defect?Defects versus BugsDefect typesRecording defects and counting defectsThe Defect Recording LogThe updated PSP process

  • Software qualityMust be in terms that are meaningful to the products users.Meet users needs;Reliably and consistently doing the users job.Its essential to have clear and exact requirements. So the development, clarification, and refinements of requirements is a major subject however its beyond the scope of this class.

  • Hierarchy of NeedsSoftware performs its required tasksProduct meets its performance requirementsSoftware is usableDevelopment is economical and timelyProduct is dependable and reliable

  • Defects & Software qualityDefects are the primary measure of quality in PSP.Finding and fixing defects will do great help to improving software quality.Finding and fixing defects is necessary but not sufficient to assure software quality.

  • Top 10 lists about Defects and qualityFinding and fixing a software problem after delivery is often 100 times more expensive than finding and fixing it during the requirements and design phase. About 40-50% of the effort on current software projects is spent on avoidable rework. About 80% of the avoidable rework comes from 20% of the defects. About 80% of the defects come from 20% of the modules and about half the modules are defect free. About 90% of the downtime comes from at most 10% of the defects.

  • Top 10 lists about Defects and qualityPeer reviews catch 60% of the defects. Perspective-based reviews catch 35% more defects than non-directed reviews. Disciplined personal practices can reduce defect introduction rates by up to 75%. All other things being equal, it costs 50% more per source instruction to develop high-dependability software products than to develop low-dependability software products. However, the investment is more than worth it if significant operations and maintenance costs are involved. About 40-50% of user programs enter use with nontrivial defects.

  • Some Fix Time DataSome typical fix time ratiosIBM rules of thumb - coding: 1.5; testing: 60; usage: 100Boehm - design: 1; development test: 15 to 40; acceptance test: 30 to 70; operation: 40 to 1000Remus - design: 1, code: 20, test: 82Ackerman - test: 2 - 10 times inspection timeRussell - inspection: 1, test: 2 to 4, use: 33PSP research - unit test takes 12 times longer than code review to find and fix defects, also the cost!

  • Related concepts about DefectsDefect: something wrong with a program, such as a syntax error, a misspelling, or an incorrect program statement. Defect injection: Defects introduced by engineers making errors.All defects, in fact, result from human errors.Defect PreventionFinding defects is expensive so it is better to avoid them in the first placeDefect RemovalThe improvement of defect finding and fixing processUnderstanding the defects you have injected, identify the mistakes that caused them, and learn how to avoid repeating the same mistakes in the future.

  • Software BugsLatent bugs mustbe operationally insignificantnot be destructive()not be observed oftenBugs are not important to the customer if they do notaffect operationscause inconveniencecost time or moneycause loss of confidence in software results

  • Defects versus BugsBugs trivializes a critical problem and fosters a wrong attitude.Bugs versus Time bombDefects are more like time bomb than bugsTrivial mistakes can have unforeseeable consequence.For example, buffer overflowDefects is a general concept than bugs

  • No Defects or Bugs!The software engineer who writes a program is best able to find an d fix its defects.They take personal responsibility for the quality of the programs they produce.Learn to write a defect-free program is an enormous challenge for a software engineer and it takes data, effective technique,and skill.

  • Class exerciseWrite a program to input the grades (Math, Program, Data structure, Algorithm Design, English) of a class and calculate the mean grades of each course. n(n) 1-2+3-4+5-6+7......+n Use any language, 10 minutes.Find the defects be injectedList the defects you often injected in your programming process

  • Answer 1 long fn(long n) { long temp=0; int i,flag=1; if(n
  • Answer 2long fn(long n) { if(n
  • Defect types

    Type No.Type nameDescription10documentationComments, messages20SyntaxSpelling, punctuation, typos(), instruction formats30Build, PackageChange management, Library, version control40AssignmentDeclaration, duplicate, names, scope, limits50InterfaceProcedure calls and references, I/O, user formats60CheckingError messages, inadequate checks70DataStructure, content80FunctionLogic, Pointer, loops, recursion, computation, function defects90systemConfiguration, timing, memory100EnvironmentDesign, compile, test, other support system problem

  • Understanding defects1.gather defect dataKeep a record of every defect you findRecord enough information on each defectAnalyze these data to see what defect types caused the most problemDevise ways to find and correct defects2.understand the defects,avoid them3.figure out how to find,fix,prevent

  • The Defect Recording LogDate Number Type Inject Remove Fix Time Fix Defect Description Help to gather defect data.Describe each defect in enough detail so you can later understand it.Analyze the data to see where you injected and removed defect,and which types caused the most trouble.

  • How to complete the log?-11.When starting to develop a program2.When you first encounter a defect3.Use a separate line for each found4.Enter the date the defect was foundDate Number Type Inject Remove Fix Time Fix Defect10/28 5.After fixing the defect, enter the defect typeDate Number Type Inject Remove Fix Time Fix Defect10/28 20

  • How to complete the log?-26.Enter the phase of the process when you injected the defectDate Number Type Inject Remove Fix Time Fix Defect10/28 20 code 7.Enter the process phase when you removed the defect.Date Number Type Inject Remove Fix Time Fix Defect10/28 20 code complie 8.For the defect fix time, estimate the time from when you first were aware Date Number Type Inject Remove Fix Time Fix Defect10/28 20 code complie 1 min

  • How to complete the log?-39.The fix defect entry10.Write a brief description of the defect in the description sectionDate Number Type Inject Remove Fix Time Fix Defect10/28 20 code complie 1 min Descriptionmissing;

  • Counting DefectsDefect numberDefect typeWhen to count defectStart counting defects whenever you complete a phase for a product or part of a product.So, after the design phase,you could count all design defects.In this class, we only count the defect in compiling and testing phase.

  • Why using the Defect Recording LogTo improve your programmingTo reduce the number of defects in your programTo save timeThe longer defects stay in a program, the more time they take to find and the harder they are to fix.Remove the defects as soon as possible after you inject themTo save moneyTo do your job responsibly

  • Updated PSP processUpdated PSP scripts: See table 12.5 in p150

  • Updated PSP process

    PSP Project Plan Summary

    Student

    Date

    Program

    Program #

    Instructor

    Language

    Summary

    Plan

    Actual

    To Date

    Minutes/LOC

    LOC/Hour

    Defects/KLOC

    Yield

    A/FR

    Program Size (LOC):

    Plan

    Actual

    To Date

    Total new and changed

    Maximum Size

    Minimum Size

  • Updated PSP process

    Time in Phase (min.)

    Plan

    Actual

    To Date

    To Date %

    Planning

    Design

    Code

    Code review

    Compile

    Test

    Postmortem

    Total

    Maximum Time

    Minimum Time

  • Updated PSP process

    PSP Project Plan Summary

    Defects Injected

    Plan

    Actual

    To Date

    To Date %

    Planning

    Design

    Code

    Code review

    Compile

    Test

    Total

    Defects Removed

    Plan

    Actual

    To Date

    To Date %

    Planning

    Design

    Code

    Code review

    Compile

    Test

    Total

  • Updated PSP process

    PSP Project Plan Summary

    Student

    Student x

    Date

    03/30/04

    Program

    Program #

    10

    Instructor

    Mr.liu

    Language

    Ada

    Summary

    Plan

    Actual

    To Date

    Minutes/LOC

    6.76

    6.12

    6.50

    LOC/Hour

    8.88

    9.80

    9.23

    Defects/KLOC

    Yield

    A/FR

    Program Size (LOC):

    Plan

    Actual

    To Date

    Total new and changed

    44

    57

    105

    Maximum Size

    58

    Minimum Size

    30

  • Updated PSP process

    Time in Phase (min.)

    Plan

    Actual

    To Date

    To Date %

    Planning

    13

    18

    33

    4.8

    Design

    11

    43

    55

    8.1

    Code

    130

    162

    308

    45.2

    Code review

    Compile

    44

    21

    70

    10.2

    Test

    82

    73

    165

    24.2

    Postmortem

    17

    32

    51

    7.5

    Total

    297

    349

    682

    100.0

    Maximum Time

    392

    Minimum Time

    203

  • Updated PSP process

    Defects Injected

    Plan

    Actual

    To Date

    To Date %

    Def/Hour

    Planning

    Design

    2

    2

    25.0

    Code

    6

    6

    75.0

    Code review

    Compile

    Test

    Total

    8

    8

    100.0

    Defects Removed

    Plan

    Actual

    To Date

    To Date %

    Def/Hour

    Planning

    Design

    Code

    Code review

    Compile

    6

    6

    75.0

    Test

    2

    2

    25.0

    Total

    8

    8

    100.0

  • PSP Quality Strategy - part 1Identify PSP quality objectives, e.g.remove all defects before first compileEstablish PSP process quality measures, e.g.overall process yieldLOC reviewed per hourExamine products revieweddetermine their ratings on the measuressee which behaviors impacted these results

  • PSP Quality Strategy - part 2Based on these data, identify your most effective work practices.Incorporate these practices in your process artifactsprocess scriptschecklistsformsIdentify measures that predict process qualityuse these as control variablesset specifications for these variables

  • PSP Quality Strategy - part 3Track your performance against these specifications.Track your process to determinewhen and if to change these specificationsactions to take for further process improvement

  • SummarySummarySoftware qualitySoftware defectsRecord the software defect-Defect Recording LogDefect typesUpdated PSP process

  • remember1. Software quality starts with defects. 2. If defects are not managed, more important quality issues cannot be adequately addressed.3. The most effective way to manage defects is with the individual software engineer4. If you dont eliminate your own defects, they will be much more expensive and time consuming to remove later.

  • AssignmentUse the Defect Recording Log to record every defect find in the program you write. Summarize the defect data in the Project Plan Summary for each program.