Mistakes Errors and Defects Basic Concepts o o
Mistakes, Errors and Defects
Basic Concepts o o You are building a project. The project is made up of “phases”. n o o o You complete a phase of the project and then move onto the next phase. Possible phases are “design”, “coding”, “testing” In the Lab. , some people would consider each “task” as a “phase”. You complete all the design, code and testing for one task, and then move onto the next task Some people would call each part of a task a phase The key element is – you decide a “phase” for your project, and then you decide n n 12/18/2021 whether you have completed that “phase” and can move onto the next stage, or whether you have to. Mistakes, keep. Errors, working to make, this phase work Defects Copyright M. Smith, ECE, University of Calgary, Canada 2
Mistakes in a project with 3 tasks Task 1 – 100 LOC – Lines of Code o 7 Task 1 mistakes are made (developer does not know this) BUT ONLY o 3 Task 1 mistakes are discovered before moving onto Task 2 -- 100 LOC – Lines of Code o 5 Task 2 mistakes are made (developer does not know this) BUT ONLY o 3 Task 2 mistakes (errors) are discovered before moving onto Task 3 o 1 mistake (defect) made in Task 1 is discovered and fixed Task 3 -- 200 LOC – Lines of Code o 2 Task 3 mistakes have been discovered and fixed – at this point in time in the project o 1 mistake from Task 1 has been discovered and fixed – at this point in time in the project o 1 mistake from Task 2 has been discovered and fixed – at this point in time in the project o ? mistakes have been made o ? Defects will be fixed? PRODUCT IS RELEASED AFTER THE DEVELOPER “COMPLETES” T 3 HOW MANY PROBLEMS LEFT IN THE PROJECT 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 3
Questions to ask o o How many mistakes is it likely that the programmer will make during Task 3? How many mistakes made during Task 3, will the programmer find in Task 3 (errors) before deciding to releasing the project to the customer? How likely is it that the programmer will, during Task 3, find any mistakes (defects) left behind from Task 2? How many mistakes (defects) can be expected to be left behind after the product has been released? 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 4
Errors and Defect o Mistake – anything you do wrong (including misreading the manual) o Error – are mistakes you make in “ this phase” of the project and FIND before moving on to the “next phase” of the project. o Defects – are mistakes you make in “ this phase” of the project and DON’T FIND before moving on to the “next phase” of the project o There is no mention of what constitutes an error or a defect – it is anything you do wrong! Includes misreading the manual Errors can both be syntax mistakes or logical mistakes. Defects are more likely to be logical mistakes. The difference is one of time -- “when (in the project) did you find the mistake” 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 5
How many errors and defects in this code? o o Can’t answer the question, until you define “phase of a project” and also know the codereview habits of the programmer. Humphreys suggests – code + assembler + link = 1 phrase 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 6
How many errors and defects in this code? o o o Editor is suggesting syntax errors in Po (key-word colour coding). Would be found by assembler before moving onto next task Formatting is suggesting an error in the loop as there should be 4 nonindented lines There are in fact 8 other mistakes in the code. How many would be caught by assembler? 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 7
Better – after a code-review o There are still 2 mistakes in code. n n 12/18/2021 A warning will be issued by the assembler and will then cause a fatal error with the linker A mistake that will not be caught by the assembler or linker and get into the next phase Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 8
Errors and defects recognized When should project be released? Task 1 – 100 LOC – Lines of Code o 7 Task 1 mistakes were made (we don’t know this) BUT ONLY o 3 Task 1 mistakes (errors) are discovered before moving onto Task 2 -- 100 LOC – Lines of Code o 5 Task 2 mistakes were made (we don’t know this) BUT ONLY o 3 Task 2 mistakes (errors) are discovered before moving onto Task 3 o 1 mistake (defect recovered) made in Task 1 is discovered and fixed Task 3 -- 200 LOC – Lines of Code o 2 Task 3 mistakes (errors) have been discovered and fixed – at this point in time o 1 mistake from Task 1 (defect recovered) has been discovered and fixed – at this point in time o 1 mistake from Task 2 (defect recovered) has been discovered and fixed – at this point in time o ? mistakes have been made o ? Defects will be fixed? PRODUCT TO BE RELEASED AFTER THE DEVELOPER “COMPLETES” TASK 3! 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 9
Should the developer release the project? o Can’t really tell with this small amount of data – metrics should be gathered over many projects. o Personal Software Process o Will demonstrate the principles 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 10
Based on the available data o o Developer does not know whether a mistake has been made Developer only knows about errors recognized and defects recovered Task 1 – 100 LOC – Lines of Code o 3 Task 1 mistakes (errors) are discovered before moving onto Task 2 -- 100 LOC – Lines of Code o 3 Task 2 mistakes (errors) are discovered before moving onto Task 3 o 2 mistake (defect recovered) made in Task 1 is discovered and fixed o 1 mistake (defect recovered) made in Task 2 is discovered and fixed o o o Based on this data – developer makes 9 mistakes per 200 lines of code developed – 45 / k. LOC -- Actually making 60 / k. LOC but doesn’t know that till later. Task 3 (assuming same level of complexity as Task 2 and 3) has 200 LOC and there fore the developer is probably making 9 +- 2 mistakes I reckon that I am having a good day if I can get below 80 k. LOC, but that is because I am not spending enough time fixing my development process. What’s your real mistake rate 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 11
Mistake Recovery Efficiency -- MRE How to calculate Mistake Recovery Efficiency Errors found for a = ------------------given project phase Mistakes found (Errors + Defects) Can’t really be calculated for THIS project till the project is finished (Must have past history available) Task 1 o 3 mistakes are discovered before moving onto Task 2 3 ERRORS FOUND o 1 defect found in Task 2 and another in Task 3 2 DEFECTS FOUND Mistake Recovery Efficiency = MRE = 3 / 5 = 60% recovery calculated Actually (but we can’t measure that ) True MRE is 3 / 7 – lower than 60% Task 2 o 3 mistakes are discovered before moving onto Task 3 3 ERRORS o 1 mistake made in Task 2 is discovered and fixed 1 DEFECT RECOVERY Mistake Recovery Efficiency = MRE 3 / 4 = 75% recovery Average MRE = (60 + 75) / 2 = 67. 5% (2/3) 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 12
Task 3 Problems with final customer code How many? – based on MRE Task 1 – 100 LOC o 7 mistakes are made – expecting only 4. 5 in this amount of code o 3 mistakes are discovered before moving onto Task 2 3 ERRORS Task 2 – 100 LOC o 5 mistakes are made – expecting only 4. 5 in this amount of code o 3 mistakes are discovered before moving onto Task 3 3 ERRORS o 1 mistake made in Task 1 is discovered and fixed 1 DEFECT RECOVERY Task 3 – 200 LOC -- Based on LOC developed – 9 errors in 200 LOC o 2 mistakes have been identified 2 ERRORS o 1 mistake from Task 1 has been discovered 1 DEFECT RECOVERY o 1 mistake from Task 2 has been discovered 1 DEFECT RECOVERY PRODUCT RELEASE HOW MANY PROBLEMS? This programmer averages MRE = 67. 5% in each phase – therefore expect that of the 9 mistakes probably made in task 3 – 9 * 0. 675 of those will be found (6. 3). Has found 2 errors already Can expect to find another 4 errors based on past performance 3 defects left will probably be left in. Mistakes, customer code from Task , 3 12/18/2021 Errors, Defects 13 Copyright M. Smith, ECE, University of Calgary, Canada
Problems with final customer code From Defects left over from T 1 and T 2 Task 1 – 100 LOC o Expect 4. 5 mistakes to be made o 3 mistakes are discovered before moving onto Task 2 3 ERRORS o 2 defects recovered (Task 2 and 3) -- probably no more defects left Task 2 – 100 LOC o Expect 4. 5 mistakes to be made o 3 mistakes are discovered before moving onto Task 3 3 ERRORS o 1 mistake made in Task 2 is discovered and fixed in T 3 1 DEFECT RECOVERY PRODUCT RELEASE HOW MANY PROBLEMS? This programmer averages MRE = 67. 5% in each phase – therefore expect that of the 9 mistakes probably made in task 1 and 2 – 9 * 0. 675 of those will be found (6. 3). Has found 9 errors already Based on the statistics from this project – developer has found all problems in Task 1 and probably most in Task 2 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 14
If you are going to do this sort of metrics seriously o The programmer needs to know their own MRE and Defect Recovery Rate. n o The programmer needs to know need to know whether the tasks were of equal difficulty n o A more difficult task can be expected to cause more than the average number of defects Is this a safety critical task n o Must collect “metrics” from past experiences Might spend more time looking for possible defects (Perhaps write more tests (TLD)) Time estimation – how long will the product take to develop? n n n 12/18/2021 How big is the product? Learn estimation skills What is your efficiency (lines of debugged code / hour)? Errors / 1000 lines of code? Defects / 1000 lines of code? How long does it take you to fix a “typical” error or defect? When fixing errors and defects – how many new mistakes do you introduce for each one you fix? (Industry about 1 in 3) What are your most common mistakes? And what are you doing to fix them in time for final exam and post-lab 3 quiz Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 15
Example on Errors / Defects / Mistakes Possible Final Exam question A student is doing 5 tasks – all roughly the same size and difficulty. You know that the students MRE = 60% and DRE = 20% Task 1 Task 2 Task 3 Task 4 Task 5 10 errors discovered 5 errors discovered 10 errors discovered 12 errors discovered 10 errors discovered 2 defects from Task 1 found 1 defects from Task 1 + 2 defects from Task 2 + 2 defects from Task 3 found 2 defects from Task 2 + 2 defects from Task 3 + 1 defect from Task 4 Explain both qualitatively (reasonability argument) and quantitatively (number argument) the following issues 1) 2) 3) The programmer moved onto Task 3 from Task 2 at the correct time – true or false The programmer should stop working on Task 5 and release the product Why is impossible in Task 5 to discover a defect from Task 5 This programmer has been using test first development (test driven development). 4) Explain why you might think that this student does not know how to write TDD tests (some people are good at testing and some are not) 5) 6) 7) 8) 9) Looking back at your previous classes – make an estimate of your MRE and DER rates Make a comment on what you feel is your MRE and DER rates now Has TDD helped you or hindered you? Some people feel that writing tests before coding takes longer that writing tests after the coding. In theory – since you need the same tests – this is not true. But in practice it often is true – explain the discrepancy What is the difference between a unit test and a system test? Using one of your labs as an example give details of a unit test and a 12/18/2021 Mistakes, Errors, Defects , 16 system test? Copyright M. Smith, ECE, University of Calgary, Canada
Some more practice on loops and arrays. Indexing through arrays array(count) = 2; o How many errors and defects if you define errors as being “found before assembler is used” 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 17
12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 18
12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 19
Array(count) = count 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 20
Hardware loop – 11 syntax errors 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 21
What defects are present? 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 22
Getting ready to go “really fast” 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 23
12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 24
Blackfin in “full parallel operation” 12/18/2021 Mistakes, Errors, Defects , Copyright M. Smith, ECE, University of Calgary, Canada 25
- Slides: 25