Software Development: Tools and Processes - Suraj @ LUMS
Transcript of Software Development: Tools and Processes - Suraj @ LUMS
Software Development: Tools and Processes
Lecture - 11: Personal Software Process
Personal Software Process (PSP) - Defects
• Defect Injection vs. Defect Removal• People make Errors which create Defects in
Programs
Can we train people to stop injecting defects?
• Defect Prevention vs. Defect Removal
PSP focuses on Defect Removal
Personal Software Process (PSP) - Defects
To-date time / To-date size
Count & enter defects injected in each phase
Calculate To-date & To-date %
Count & enter defects
removed in each phase
Code Review before Compile
• Review takes time irrespective of the sequence
• Saves compile time• Reviews are generally not thorough, after
the compile
Project Plan should include resources for Code Reviews
Personal Software Process (PSP) - Finding defects
• Find the type of defect (syntax, design, interface etc.) and then improve using Pareto principle
We find defects through code review and testing Which one will be more efficient?
Any Relationship between compile defects and unit test defects?
Peer Reviews or Inspections are effective tool for find defects
Data on compile and test defects
• Relation in Compile and Test Defects
• Relation in Compile and Post Development Defects
Personal Software Process (PSP) - Finding defects
Methods to find defects (coding)• Compiler can be used
– Provides only symptoms not the defects• Testing can be done for finding defects
– Finds symptoms not the defects– Only those defects will be found for which the test cases are
prepared?– Time consuming activity
• Review the source code– Do it before the first compile– More efficient because we find actual problems– Efficiency can be improved with practice
• Let the user test the program and report errors– Is it a good idea?
Defective program can be repaired but it will be less robust
What do you understand by coding standards?
Personal Software Process (PSP) - Code review check lists
• We can make code review more effective by using a checklist
• Steps for making a checklist• Add the most frequently occurring defects in checklist• With experience add more defects• Make group of similar checks• Trim the checklist over time
Check lists helps you ensure that a procedure is followed
Sample Check List
Personal Software Process (PSP) - Projecting Defects
• Once we have gathered defect data then we should be able to analyze that data
• Defect data is used to estimate the number of defects which will be injected in next program
• Project Plan Summary: Defect/KLOC• Defect injection data also enables the engineers to
understand the type of defects they are injecting• Fluctuating defect injection and removal numbers
indicate that …..
Personal Software Process (PSP) - Projecting Defects
• Experience in coding has no direct relation to defect injection
• There is not much improvement in defect injection with passage of time
• After PSP training, the defect injection goes down
Personal Software Process (PSP) - Projecting Defects
Personal Software Process (PSP) - Projecting Defects
From previous prog. To-date
Total defect / actual size *
1000
Plan Defects/Kloc/ plan Loc/1000 Use to-date %
for phases
Estimated total defects
Understanding the concept
• What is Defect / KLoc• What is planned defect injection in phases• What is planned defect removal in phases
• What is the significance of To Date• What is the significance of To Date %
Now you may want to remove the data of earlier few programs to have more realistic projections
Defect Removal Economics• Defect removal is expensive because defects are hard to
find and fix
• To control cost we should know about defect removal effectiveness and distribution
• Defect removal metric = Defect Removed / Hour
• Defect removal yield = % defects found by removal method
• Why should we calculate Defect Removal Yield?
If defect injection rate > defect removal rate then its called race condition
Defect Removal Economics• Few minutes are spent in personal code review
• Unit test take more time but the average is about half an hour
• Inspections are effective way of finding the defects. This takes more time than personal inspections and code reviews
• Testing by others take a lot of time and effort
Now we should be able to have a plan to reduce the total time spent in removing defects effectively
Defect Removal Economics
250 Engineers on the Microsoft NT system spent a full year in system test finding and fixing 30,000 defects. This
averages 16 hours per defect
Even after the release, Microsoft released a lots of bug fixes in the form of updates and service packs
Defect Removal Economics
Defect Removal Economics
Defect Removal EconomicsImprove defect removal rate
• Focus on the yield – try to achieve yield of 70% or more
• Do code reviews before the first compile
• Improve the review rates by adjusting the check lists –the steps which don’t find the defects, drop them – add new steps for finding defects
If you keep on using the same inputs, you are likely to get the same output. Therefore, unless you change the way
you work, you cannot expect better results
Defect Removal EconomicsHow to reduce defect-injection rate?
• Record all of your defects
• Produce better designs – design should be complete and well documented
• Use better methods – improve the way you work to do a project – focus on all the phases of SDLC
• Use better tools – to develop the programs and tracking your injected defects
Product Quality• Each defect removal method acts as filter• Such method removes some percentage of defects
• If Y = .4 x then what is the efficiency of defect filter?• Phase Yield = defect removed in phase x 100
defects at phase entry• Rule of thumb: No of defects in product is equal to
number of defects found in last removal phase• We can calculate yield of different phases• process yield = % of defects found before first compile
Defect FilterX Y
Design Defects
• What constitutes a design?• Examples of design defects• Include defects for architecture, logic, functions, performance,
timing, etc.• Design has different abstraction levels• Causes of design defects• Design mistake• Simple Error• Misunderstood requirements• Inadequate context understanding• Design representation• Graphical representation• Pseudo code • Mathematical models
Product Quality
Product Quality
Product Quality
How can we measure the process quality?
Process Quality
• In PSP we measure the process quality by Defect Injection and Defect Removal
• Cost of Quality• COQ = failure cost + Appraisal cost + Prevention cost
• Failure: time spent in fixing defects • Appraisal: time spent in finding defects • Prevention: time spent to stop defect injection
• In PSP Appraisal cost: Review time • Failure Cost: compile time and test time• Cost of Quality is the percentage of total time
Appraisal to failure ratio
• Appraisal to Failure Ratio - A/FR• What is the significance of A/FR?• We should increase the A/FR until the yield
reaches 80% or more
Appraisal to failure ratio
Appraisal to failure ratio
Appraisal to failure ratio