Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

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

, 10 Nov 2011
Rate this:
Please Sign up or sign in to vote.
A series of brief articles where I want to show you the real state of things.

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 so as if misprints and mistakes through inattention were the lot of students. 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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

viva64.com

Russian Federation Russian Federation

We develop the PVS-Studio static code analyzer for C/C++/C++11.

PVS-Studio is a static code analyzer for C/C++ (Visual Studio 2005/2008/2010) with a simple licensing and pricing policies which is easy to install and use without need to deploy a complex maintenance environment.

Follow on   Twitter

Comments and Discussions

 
GeneralMy vote of 5 PinmemberUilleam15-Nov-11 4:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 10 Nov 2011
Article Copyright 2011 by viva64.com
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid