CS 350, slide set 5ReadingTopicsProcessSome basic definitionsPSP processPSP process script - 1PSP Process Script - 2Software QualityWhat’s a defect in PSP?Why record defect types?Goals of defect formFixing defectsWays to find code defectsWhy Code Reviews?Review before compiling!Additional commentsCode review script - 1Code Review Script - 2Code Review ChecklistC++ Coding StandardCS 350, slide set 5M. OverstreetOld Dominion UniversitySpring 2005ReadingPSP text, ch. 11, 12, 13, 14TopicsA software development processMeasuring software qualityFinding defectsA code review checklistProcessA sequence of steps to complete a taskProvides guidanceCan provide a record of what has been accomplishedCan provide an indication of percent of project which has been completed•After we’ve used 50% of time allocated, have we finished 50% of the work?Some basic definitionsRecall defn’s from Ch. 5Product: something you produce, usually for someone elseProject: produces a productTask: an element of workProcess: the steps to produce a productPlans: the way a specific project is to be done; how, when, at what costsJob: something you do; either a project or a taskMoreProcesses can have various phasesEach phase can consist of several activitiesPSP processPlanningCode DesignTest DesignCodeCompileTestPost MortemRequirementsFinished productScriptsProjectplansummaryLogsPlan and actualproject and processdataTime anddefect dataGuidancePlan dataActualdataPSP process script - 1PurposeTo guide you in developing programsEntryCriteriaProblem statementPSP Project Plan Summary formActual size and time data from old projectsTime Recording Log1 PlanningIdentify program functionsIdentify test objectivesEstimate max, min, and total LOCDetermine minutes/LOCCalculate max, min, and total timeEnter data in Project Plan Summary FormRecord planning time in Time Recording Log2 Code designDesign the programRecord design in specified formatEnter code design time in Time Recording Log3 Test designPrepare test plans and dataEnter test design time in Time Recording logPSP Process Script - 23 CodeImplement the designComplete a MakefileUse a standard format for entering codeRecord coding time in Time Recording Log4 CompileCompile the codeFix defects as discoveredRecord time in Time Recording Log5 TestTest the programFix defects as discoveredComplete test reportsRecord time in Time Recording Log6 PostmortemComplete the Project Plans Summary with actual time and size dataRecord postmortem time in Time Recording LogExit criteriaA thoroughly tested programA properly documented designComplete source codeDocumented and corrected test dataA MakefileA completed set of test reportsA completed Project Plan SummaryCompleted Time Logs; All required submitted.Software QualityComplex topicHow do customers measure the quality of a product?How do developers measure the quality of a product?Includes, among many possibilities:How many problems does a typical user encounter when using the product?Does the product provide key functionalities to the user?How do features of this product compare with competing products?How easy is it to enhance/modify/extend/revise/tailor the product?How easily can components from this product be used in other products?We’re going to keep it simple: defects/KLOCWhat’s a defect in PSP?Anything wrong with a program:Misspelling in commentBad punctuation, poor formattingIncorrect logicMissing functionalityDocumentation, format does not conform to organizational standardIn short, any change you make to code after you type it in and proofread it.Errors are mistakes people make. Some result in defects in code.Why record defect types?To have real data on what is causing problemsTo help direct possible changes to software processesPointless unless defect types, frequencies, and times-to-fix are periodically analyzed and acted uponGoals of defect formImprove your programmingReduce number of defects in your codeSave you timeTo do you job responsibly: you find your own mistakes rather than someone else finding themFixing defectsRecognize defect symptomsFrom symptoms, deduce likely locations of defectsSometimes hard to do, sometimes notIdentify sourceFix itVerify that the fix:Resolved the problemDid not introduce new problemsWays to find code defectsLet others find them (not recommended)This approach has some disadvantagesUse testing to locate defectsWidely used; very expensive; misses manyUse mathematical methods (proofs of correctness) to locate defectsRarely used; very expensive, maybe infeasible in most casesUse Code ReviewsUse Code Inspections (will discuss later)Why Code Reviews?Compilers miss lots of typo/syntax errors (probably 10% -- depends on language)Testing misses lots of defects (some assert 50%)No matter how many defects are in the code to begin with!Testing and code reviews are probably complimentary activitiesCode reviews can find some defects not easily found in testingTesting finds can some defects not easily found by code reviewsReview before compiling!Takes as long to do review before as afterSaves some compile timeTypically 10% to 15% if done without reviewTypically ~3% if done with reviewCompiles finds errors equally well with or without reviewReviewers don’t find errors as effectively if they know the code has compiled cleanly. Probably human nature:•if we don’t really expect to find things, we don’t look as hard.•if we expect to find things and don’t, we probably look again.Additional commentsIn PSP, you do your own reviews.Goal is to save you time, improve your code qualityIn TSP (remember the next textbook?), this is supplemented by inspections.Since fixing code is so expensive, we have much industrial data that shows reviews pay!Code review script - 1Entry criteria Check that the following are on hand:1. The requirements statement2. The program design3. The program source code4. The coding standards5. A Defect Recording Log1 Review procedure First produce the finished program source code.Before compiling, print a source listingNext, do the code reviewDuring the code review, carefully check every line of source code to find and fix as many defects as possible2 Fix the defects Fix all defects foundCheck the fixes to ensure they are correctRecord the defects
View Full Document