What I'm not talking about
How many errors are there to be found?
Probably around 1-25 per 1000 lines of code
What kinds of errors?
-
18%-36% of errors are clerical errors
-
The 3 most expensive errors of all time - $1.6 billion, $900 million, $245 million - involved changing a single character in a correct program
-
Most errors (~85%) can be fixed in a short period of time
-
Most errors are the programmer's fault
-
Other common error sources - changing requirements, misunderstanding the design
How many can we expect to find?
If you do it well: 70%
If you do it poorly: 20%
Effectiveness of different bug-finding tools
How are errors distributed?
In general, 80% of the errors come from 20% of the code.
Also, 50% of errors from 5% of the code
Case study at IBM: 31 of 425 classes found to be error-prone.
After repair/refactoring, defects reported by customers were reduced by 1000%
Pull request length
Example
Longer pull requests take longer to get reviewed/merged (why?)
How quickly can you do code review?
Estimates: 500 lines/hour for "application" code
125 lines/hour for "system" code
Attention span/effectiveness drops after 2 hours of review
Start at 200 lines/hour
Advice
Limit the number of context switches your reviewers need to make
Try to keep review time under 2 hours
Note areas that have previously generated many bugs, and focus extra attention on them during review
Take extra care with small changes (1-10 lines)
Let machines help you (linting, static analysis, spell checking)
Kevin Track
Git pre-commit hooks
,
, |\ ,__
|\ \/ `.
\ `-.:. `\
`-.__ `\=====|
/=`'/ ^_\
.' /\ .=)
.-' .'| '-(/_|
.' __( \ .'`
/_.'` `. |`
\ |
|/
source
Thanks!
Kevin Burke
These slides are available at:
←
→
/
#