BIT 285: (Web) Application Programming Instructor: Craig Duckett Lecture 14: Thursday, February 19, 2015 SQL Database and LINQ 2 Code Reviews 3 What is a code review? From Wikipedia: "Code review is systematic examination (sometimes referred to as peer review) of computer source code. It is intended to find mistakes overlooked in the initial development phase, improving the overall quality of software. Reviews are done in various forms such as pair programming, informal walkthroughs, and formal inspections.[1]" "Code review practices fall into two main categories: formal code review and lightweight code review.[1]" Formal review: "a careful and detailed process with multiple participants and multiple phases" Lightweight: sometimes a walkthrough, but also includes things like pair programming "Code review rates should be between 200 and 400 lines of code per hour.[4][5][6][7]“ “Industry data indicates that code reviews can accomplish at most an 85% defect removal rate with an average rate of about 65%.[9]” Goals: Ensure code quality On-the-job technical training I.e., this spreads best practices amongst the group 4 MSDN ('Setup' is good, the rest is C++ specific) Hand out hard copies beforehand Everyone needs to have read through this prior to the meeting Also send out electronic copies for searching, using tools on, etc, etc Avoid checking in stuff after printing Each page needs: File name Page number Line numbers (Clearly, the idea is for a group of people to sit down & go over this stuff in person) 5 Today's work Google/Bing for existing checklists for 10 minutes Remember items that you'd like to see in your checklist Group list-making Brainstorm cull Pick a code sample to review Aim for a single thing, with ~150 lines of code or so. I'm guessing that a single page/feature is probably about good. Print out the stuff-to-review Each reviewer should put their name on it (I'm interested in seeing your mark-up/questions/comments) Have everyone read through it (10-20 minutes) & mark it up Do the code review Discuss the code in a respectful, quality-oriented manner 6 For Release #2 Each group needs to do finish the code review we started in class today, and include it with the R2 release (Put all of the following into GitHub, and name the directory something obvious ) For the review, include: Your checklist List any sources that you used Include a copy of the code at the time that you reviewed it This should include your mark-up The group's list of notes from the review This includes both advice/changes to the reviewed code as well as general advice for everyone In addition to whatever notes you want to include, it is expected that you will find some errors. Not finding errors would be extremely suspicious. Each person needs to write up a short reflection on the experience. These should be private, and given directly to the instructor. I'm expecting ½ to 1 page, single-spaced, with some quality thoughts