last line effect
DESCRIPTION
TRANSCRIPT
Last Line EffectWho? Andrey Karpov
What He Does? An unusual jobLike What? Analyze program code of various applications with the help of
static analyzers and write descriptions of errors and defects he
findsNice Job right?
How do I know about this?
Can I know more about it?
• Do you like to TYPE a similar code again & again while programming?
NO• So What you do at this situation?
COPY & PASTE
What’s wrong with this?
• you risk easily forgetting to change something in the pasted lines and thus giving birth to errors.
• What kind of errors? Can you show me some examples?
SURE
What’s wrong with this?
What’s wrong with this?
Note the line "z += other.y;". The programmer forgot to replace 'y' with 'z' in it
What’s wrong with this?
What’s wrong with this?
The length of the "THREADS=" string is 8 characters, not 6
What’s wrong with this?
What’s wrong with this?
The SetW() function should be called at the end
What’s wrong with this?
What’s wrong with this?
The last line was pasted mechanically and is redundant. There are only 3 items in the array
What’s wrong with this?
What’s wrong with this?
The length of the "BITLIST" string is 7, not 3 characters
What was his conclusion?
• The probability of making a mistake in the last pasted block of code is 4 times higher than in any other block
• So BE CAREFUL while doing COPY & PASTE
• Make sure to REVIEW it before committing to version control repositories
You can read about this more on the following link,
http://www.viva64.com/en/b/0260/
Thank You & Have a Great Week End