Software Development: Tools and Processes - Suraj @ LUMS

33
Software Development: Tools and Processes Lecture - 11: Personal Software Process

Transcript of Software Development: Tools and Processes - Suraj @ LUMS

Page 1: Software Development: Tools and Processes - Suraj @ LUMS

Software Development: Tools and Processes

Lecture - 11: Personal Software Process

Page 2: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 3: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 4: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 5: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 6: Software Development: Tools and Processes - Suraj @ LUMS

Data on compile and test defects

• Relation in Compile and Test Defects

• Relation in Compile and Post Development Defects

Page 7: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 8: Software Development: Tools and Processes - Suraj @ LUMS

What do you understand by coding standards?

Page 9: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 10: Software Development: Tools and Processes - Suraj @ LUMS

Sample Check List

Page 11: Software Development: Tools and Processes - Suraj @ LUMS

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 …..

Page 12: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 13: Software Development: Tools and Processes - Suraj @ LUMS

Personal Software Process (PSP) - Projecting Defects

Page 14: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 15: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 16: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 17: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 18: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 19: Software Development: Tools and Processes - Suraj @ LUMS

Defect Removal Economics

Page 20: Software Development: Tools and Processes - Suraj @ LUMS

Defect Removal Economics

Page 21: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 22: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 23: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 24: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 25: Software Development: Tools and Processes - Suraj @ LUMS

Product Quality

Page 26: Software Development: Tools and Processes - Suraj @ LUMS

Product Quality

Page 27: Software Development: Tools and Processes - Suraj @ LUMS

Product Quality

Page 28: Software Development: Tools and Processes - Suraj @ LUMS

How can we measure the process quality?

Page 29: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 30: Software Development: Tools and Processes - Suraj @ LUMS

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

Page 31: Software Development: Tools and Processes - Suraj @ LUMS

Appraisal to failure ratio

Page 32: Software Development: Tools and Processes - Suraj @ LUMS

Appraisal to failure ratio

Page 33: Software Development: Tools and Processes - Suraj @ LUMS

Appraisal to failure ratio