SlideShare a Scribd company logo
1 of 2
Download to read offline
Myths about static analysis. The second
myth - expert developers do not make
silly mistakes
Author: Andrey Karpov
Date: 02.11.2011
While communicating with people on forums, I noticed there are a few lasting misconceptions
concerning the static analysis methodology. I decided to write a series of brief articles where I want to
show you the real state of things.
The second myth is: "Expert developers do not make silly mistakes that are mostly caught by static code
analyzers".
This is how this statement looks in discussions on forums (this is a collective image):
I, a skilled developer, haven't had any problems with memory spoiling, object lifetime, etc.
for N years. Static analysis is a tool for "McDonald's", and here (on a professional forum)
there are only geeks. Now I mostly face problems with difficult-to-test algorithms and
integration with other developers using implicit contracts on object states.
It sounds as if typos and inattentive mistakes were solely the work of amateurs. Professional developers
have not made them for a long time and now mostly deal with such complex errors like synchronization
issues or complex data processing algorithms.
It is not so. All the programmers make silly mistakes. I know that you haven't heard me, so I repeat this
heretical thought once again: all the programmers make silly mistakes. It doesn't matter how skillful
they are. To err is human. Errors they make are most often very simple.
Programmers take my statement about errors with great unfriendliness. In their opinion, they are those
who haven't made such mistakes for many years. I think it is the effect of an interesting aspect of our
psyche that sifts memories about unpleasant moments of the programming practice.
Let's digress from our subject a bit and recall why various horoscopes are so enduring. The first reason is
very vague formulas that one can easily apply to oneself. But we are interested in the second point:
people do not remember cases when a prophecy didn't come true. But they do remember and tell the
others about those cases when some situation in their life coincided with one described in a horoscope.
So it turns out that when we speak about and recall horoscopes, we find N evidences that they work and
do not remember about N*10 cases when they did not work.
Something like that happens to a programmer when searching for errors in code. You remember
complex and interesting errors very well and can discuss them with your colleagues or write a blog-post
about them. But when you notice that you have written 'BA' variable instead of 'AB', you will simply fix
the bug and the fact will slip from your memory. Freud noticed one peculiarity of our memory: one
tends to remember positive statements about oneself and forget negative statements. If a person fights
a complex error in an algorithmic task, when he finally fixes it, he considers himself a hero: this fact is
worthy remembering and even telling the others. But when a programmer finds a silly bug, there is no
reason and wish to remember it.
What proofs do I have? Although most misprints and bugs get fixed finally, some of them remain
unnoticed in programs. A lot of examples of these you may find in this article. You will see that it were
not novices who made the mistakes cited in the article, but skilled programmers.
The conclusion is: programmers spend much more time on fixing misprints than they think. Static
analysis tools can help to significantly save developers' efforts, detecting some of these errors before
the testing stage.

More Related Content

Similar to Myths about static analysis. The second myth - expert developers do not make silly mistakes

The D language comes to help
The D language comes to helpThe D language comes to help
The D language comes to helpPVS-Studio
 
Konstantin Knizhnik: static analysis, a view from aside
Konstantin Knizhnik: static analysis, a view from asideKonstantin Knizhnik: static analysis, a view from aside
Konstantin Knizhnik: static analysis, a view from asidePVS-Studio
 
Searching for bugs in Mono: there are hundreds of them!
Searching for bugs in Mono: there are hundreds of them!Searching for bugs in Mono: there are hundreds of them!
Searching for bugs in Mono: there are hundreds of them!PVS-Studio
 
Of Rowers and Programmers, or What's in Common Between Software Development B...
Of Rowers and Programmers, or What's in Common Between Software Development B...Of Rowers and Programmers, or What's in Common Between Software Development B...
Of Rowers and Programmers, or What's in Common Between Software Development B...Andrey Karpov
 
Static analysis and ROI
Static analysis and ROIStatic analysis and ROI
Static analysis and ROIPVS-Studio
 
Static analysis and ROI
Static analysis and ROIStatic analysis and ROI
Static analysis and ROIAndrey Karpov
 
Documentation for developers
Documentation for developersDocumentation for developers
Documentation for developersMichael Marotta
 
What do static analysis and search engines have in common? A good "top"!
What do static analysis and search engines have in common? A good "top"!What do static analysis and search engines have in common? A good "top"!
What do static analysis and search engines have in common? A good "top"!PVS-Studio
 
10 tips to save you time and frustration while programming
10 tips to save you time and frustration while programming10 tips to save you time and frustration while programming
10 tips to save you time and frustration while programmingHugo Shi
 
Lessons Learned About Software Development
Lessons Learned About Software DevelopmentLessons Learned About Software Development
Lessons Learned About Software DevelopmentJeffrey Ryan Thalhammer
 
Are 64-bit errors real?
Are  64-bit errors real?Are  64-bit errors real?
Are 64-bit errors real?PVS-Studio
 
WORKSHOP: Making the World Easier with Interaction Design
WORKSHOP: Making the World Easier with Interaction DesignWORKSHOP: Making the World Easier with Interaction Design
WORKSHOP: Making the World Easier with Interaction DesignCheryl Platz
 
Yikes...It Looks Like That?! - UI Worst Practices
Yikes...It Looks Like That?! - UI Worst PracticesYikes...It Looks Like That?! - UI Worst Practices
Yikes...It Looks Like That?! - UI Worst PracticesBruce Elgort
 
Designing for the Right Audience (with notes)
Designing for the Right Audience (with notes)Designing for the Right Audience (with notes)
Designing for the Right Audience (with notes)Danielle Arvanitis
 
Why pair programming is a good idea
Why pair programming is a good idea Why pair programming is a good idea
Why pair programming is a good idea Designveloper
 
User Experience 1: What is User Experience?
User Experience 1: What is User Experience?User Experience 1: What is User Experience?
User Experience 1: What is User Experience?Marc Miquel
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsSteven Smith
 
Webdev and programming
Webdev and programming  Webdev and programming
Webdev and programming George Ingram
 
An ideal static analyzer, or why ideals are unachievable
An ideal static analyzer, or why ideals are unachievableAn ideal static analyzer, or why ideals are unachievable
An ideal static analyzer, or why ideals are unachievablePVS-Studio
 
0136 ideal static_analyzer
0136 ideal static_analyzer0136 ideal static_analyzer
0136 ideal static_analyzerPVS-Studio
 

Similar to Myths about static analysis. The second myth - expert developers do not make silly mistakes (20)

The D language comes to help
The D language comes to helpThe D language comes to help
The D language comes to help
 
Konstantin Knizhnik: static analysis, a view from aside
Konstantin Knizhnik: static analysis, a view from asideKonstantin Knizhnik: static analysis, a view from aside
Konstantin Knizhnik: static analysis, a view from aside
 
Searching for bugs in Mono: there are hundreds of them!
Searching for bugs in Mono: there are hundreds of them!Searching for bugs in Mono: there are hundreds of them!
Searching for bugs in Mono: there are hundreds of them!
 
Of Rowers and Programmers, or What's in Common Between Software Development B...
Of Rowers and Programmers, or What's in Common Between Software Development B...Of Rowers and Programmers, or What's in Common Between Software Development B...
Of Rowers and Programmers, or What's in Common Between Software Development B...
 
Static analysis and ROI
Static analysis and ROIStatic analysis and ROI
Static analysis and ROI
 
Static analysis and ROI
Static analysis and ROIStatic analysis and ROI
Static analysis and ROI
 
Documentation for developers
Documentation for developersDocumentation for developers
Documentation for developers
 
What do static analysis and search engines have in common? A good "top"!
What do static analysis and search engines have in common? A good "top"!What do static analysis and search engines have in common? A good "top"!
What do static analysis and search engines have in common? A good "top"!
 
10 tips to save you time and frustration while programming
10 tips to save you time and frustration while programming10 tips to save you time and frustration while programming
10 tips to save you time and frustration while programming
 
Lessons Learned About Software Development
Lessons Learned About Software DevelopmentLessons Learned About Software Development
Lessons Learned About Software Development
 
Are 64-bit errors real?
Are  64-bit errors real?Are  64-bit errors real?
Are 64-bit errors real?
 
WORKSHOP: Making the World Easier with Interaction Design
WORKSHOP: Making the World Easier with Interaction DesignWORKSHOP: Making the World Easier with Interaction Design
WORKSHOP: Making the World Easier with Interaction Design
 
Yikes...It Looks Like That?! - UI Worst Practices
Yikes...It Looks Like That?! - UI Worst PracticesYikes...It Looks Like That?! - UI Worst Practices
Yikes...It Looks Like That?! - UI Worst Practices
 
Designing for the Right Audience (with notes)
Designing for the Right Audience (with notes)Designing for the Right Audience (with notes)
Designing for the Right Audience (with notes)
 
Why pair programming is a good idea
Why pair programming is a good idea Why pair programming is a good idea
Why pair programming is a good idea
 
User Experience 1: What is User Experience?
User Experience 1: What is User Experience?User Experience 1: What is User Experience?
User Experience 1: What is User Experience?
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patterns
 
Webdev and programming
Webdev and programming  Webdev and programming
Webdev and programming
 
An ideal static analyzer, or why ideals are unachievable
An ideal static analyzer, or why ideals are unachievableAn ideal static analyzer, or why ideals are unachievable
An ideal static analyzer, or why ideals are unachievable
 
0136 ideal static_analyzer
0136 ideal static_analyzer0136 ideal static_analyzer
0136 ideal static_analyzer
 

Myths about static analysis. The second myth - expert developers do not make silly mistakes

  • 1. Myths about static analysis. The second myth - expert developers do not make silly mistakes Author: Andrey Karpov Date: 02.11.2011 While communicating with people on forums, I noticed there are a few lasting misconceptions concerning the static analysis methodology. I decided to write a series of brief articles where I want to show you the real state of things. The second myth is: "Expert developers do not make silly mistakes that are mostly caught by static code analyzers". This is how this statement looks in discussions on forums (this is a collective image): I, a skilled developer, haven't had any problems with memory spoiling, object lifetime, etc. for N years. Static analysis is a tool for "McDonald's", and here (on a professional forum) there are only geeks. Now I mostly face problems with difficult-to-test algorithms and integration with other developers using implicit contracts on object states. It sounds as if typos and inattentive mistakes were solely the work of amateurs. Professional developers have not made them for a long time and now mostly deal with such complex errors like synchronization issues or complex data processing algorithms. It is not so. All the programmers make silly mistakes. I know that you haven't heard me, so I repeat this heretical thought once again: all the programmers make silly mistakes. It doesn't matter how skillful they are. To err is human. Errors they make are most often very simple. Programmers take my statement about errors with great unfriendliness. In their opinion, they are those who haven't made such mistakes for many years. I think it is the effect of an interesting aspect of our psyche that sifts memories about unpleasant moments of the programming practice. Let's digress from our subject a bit and recall why various horoscopes are so enduring. The first reason is very vague formulas that one can easily apply to oneself. But we are interested in the second point: people do not remember cases when a prophecy didn't come true. But they do remember and tell the others about those cases when some situation in their life coincided with one described in a horoscope. So it turns out that when we speak about and recall horoscopes, we find N evidences that they work and do not remember about N*10 cases when they did not work. Something like that happens to a programmer when searching for errors in code. You remember complex and interesting errors very well and can discuss them with your colleagues or write a blog-post about them. But when you notice that you have written 'BA' variable instead of 'AB', you will simply fix the bug and the fact will slip from your memory. Freud noticed one peculiarity of our memory: one tends to remember positive statements about oneself and forget negative statements. If a person fights a complex error in an algorithmic task, when he finally fixes it, he considers himself a hero: this fact is
  • 2. worthy remembering and even telling the others. But when a programmer finds a silly bug, there is no reason and wish to remember it. What proofs do I have? Although most misprints and bugs get fixed finally, some of them remain unnoticed in programs. A lot of examples of these you may find in this article. You will see that it were not novices who made the mistakes cited in the article, but skilled programmers. The conclusion is: programmers spend much more time on fixing misprints than they think. Static analysis tools can help to significantly save developers' efforts, detecting some of these errors before the testing stage.