Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
A post about static code analysis for p…

A post about static code analysis for project managers, not recommended for the programmers

Apr 14 2017
Author:

If you consider yourself a good programmer or at least you think your level is above average, I do not recommend reading this article. This article is meant for the managers of software projects. I would like to discuss here quite important, but very boring issues (for programmers), related to the methodology of static code analysis.

0498_static_analysis_for_project_managers/image1.png

I hope, this introduction has stopped some programmers from reading. Someone may still continue reading, but this is the free will. We are going to speak about things that aren't much pleasant for the programmers.

Our company develops a static code analyzer PVS-Studio, meant to look for errors in the code of programs, written in C, C++ and C#. The idea is simple: we run the analyzer and examine those code fragments that seemed suspicious to it. In general, this is some kind of automatic code-review.

For any manager and the programmers themselves it is clear that the high-quality code is better than of low-quality. It's also clear to everybody that the less glitches has the program, the better.

But here comes the most interesting part. Although everybody understands importance of the high-quality code, programmers often get furious when they are offered to use static analysis on the code. It seems as they were offended, their professionalism was questioned, and they are eager to reply with all their arsenal of negative criticism. Over the years we have seen such a large amount of brickbats like this:

  • "this is a tool for students, in our team we have only experts, that's why if we have errors, they are only related to the synchronization of the threads".
  • "we do not use static code analysis as we hire only professionals that are above average"

I think that if a project manager would be present during such discussions, then quite a lot of programmers would get an old-fashioned look for the arrogance. Every manager can recall a situation when they were looking for a bug which turned out to be a stupid typo. Or, there were cases when the manager started being very skeptical: if everything is fine, why does the application continue crashing from time to time? The managers don't see the process of the project development and the appearing issues as positively as the developers.

0498_static_analysis_for_project_managers/image2.png

Figure 1. Programmers are often too rosy, being convinced that everything is fine.

So I would like to unravel up a mystery, which is of course is not a mystery at all. Programmers have a trouble with estimating their level of proficiency. An article "The Problem With 'Above Average Programmers" gives a nice explanation of this effect. I quote an excerpt:

How would you rate your programming skills? (Below Average, Average, or Above Average)?

Based on psychological studies across many different groups, about 90% of all programmers will answer "Above Average".

Of course, that can't possible be true. In a group of 100 people, 50 are above average, 50 are below average. This effect is known as illusory superiority. It is described in may spheres, but even if you haven't heard about this, you will most likely answer "above average".

This is a problem, that prevents programmers from learning new technology and methodology. In our case it hinders positive attitude to the static code analysis. It is very unpleasant for a programmer to realize that some program will teach how to code. It is even more unpleasant when the analyzer detects stupid errors in the ideal code and makes them publicly available. It takes some will and wisdom to note and accept faults and defects in the code. It's much easier to write some negative feedback about the tool and in general about some technology and continue living in the comfortable and closed world.

The analyzer PVS-Studio finds bugs in the code of such projects as Qt, MSBuild, LLVM, GCC, GDB, Chromium. Developers of these projects cannot be rated as below average. However, this doesn't prevent the programmers to answer that their code is very qualitative and that the analysis is not relevant for them at all.

I like asking in such cases: who made these 11000 errors, if there are only "above average" professionals everywhere? The question is, of course, rhetorical, and I'm not waiting for an answer.

I think managers are realizing what I am getting at. Static code analyzers are essential during the development of medium and large-sized projects. It helps to fight against a lot of errors and control the development process in general. Regular checks help to detect abnormal growth of the number of bugs, caused by the fact that there is some programmer who is about to quit the job and writes sloppy code, because he doesn't care much, but has to pretend that he is working. This situation was made up, of course, but it is really necessary to have a tool that can asses the quality of the project and the analyzer warnings is one of the best metrics.

By the way, here is an interesting story on the topic. Quite recently, my colleague has checked CryEngine V project and found a lot of bugs. There were so many High level warnings that my colleague didn't have enough patience to have a look at all of them. Then, all of a sudden, we learn that Crytek has been experiencing some problems and several programmers aren't getting the salaries for more than 3 months already. An unhealthy situation in the company affected the quality of the code. It was interesting to see such a clear relationship.

In general, you should not hesitate to force programmers to use static code analysis. Let it be not PVS-Studio, but some Cppcheck (that does simple checks, but for free). This will already be great. The programmer may start objecting, so the manager has to remain firm.

Often the programmers refer to the fact that the work with the analyzer takes time, forcing to view false positives.

I cannot help being sarcastic here. Oh, well... To spend a day setting up the analyzer and suppressing the false positives is too much. At the same time to sit and look for the bug for a week is totally fine.

Proof: a bug that took about 50 hours of unsuccessful search was found and detected in less than an hour.

By the way, it's very simple to integrate the analyzer to the development process if there is no need to look for the errors in the old code. PVS-Studio can show errors that are related only to the new or the edited code (see Mass Suppression of Analyzer Messages).

The managers should be very skeptical about the objections of the programmers of why they do not need a static analyzer. They may really not need them. It is necessary for the project. This is one of the methodologies, like unit-tests, for example, that allows increasing the reliability of the code and reducing the expenses for its maintenance. The quicker the errors will be found, the better. Static analyzers help detecting errors at the earliest stage, i.e. once they appear in the code.

0498_static_analysis_for_project_managers/image3.png

Figure 2. Please note, some programmers use static analysis in a wrong way.

Another important point. Some programmers may claim that there were few errors found during the testing, so the implementation of the analyzer is not rational. Don't let them confuse you. Of course, there won't be a lot of bugs in the working code, otherwise the program won't work. However, finding and fixing bugs can be very expensive. Often, a lot of user complaints and hours of meditation of the programmers in the debugger could be avoided just be one run of the code analyzer. The whole point of and the use of static analysis is in its regular use, rather than in occasional runs.

I've heard myself several times, that some programmers run static analyzers before the release. Is there are people who do this and state that this is normal, they are not suitable for this profession. This is the most incorrect way of using the static analyzers. It is the same as turning on the compiler warnings before the release, but disable them during the rest of the time.

Thank you for your attention. I suggest everybody who is interested in the methodology of static analysis in general and in PVS-Studio analyzer in particular, contact us. We can help to check your project, set up the analyzer and show how to deal with the issued warnings.

Popular related articles


Comments (0)

Next comments next comments
close comment form