Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will show how the analyzer can be useful. We cannot prove absolute accuracy of all calculations in the article, but we suppose the reader will agree with our thoughts, and it will help to make a decision in the matter of getting the license.
First we wanted to implement a ROI-Calculator on the site and post a detailed description of its working principles. However, having prepared a description, it became clear that the calculator is unnecessary. The tables given in the description are enough. So we just drew up this explanation as an article you are reading right now. Hopefully it will help you fully realize the rationality of regular usage of the PVS-Studio static code analyzer.
PVS-Studio is a tool designed to detect errors and potential vulnerabilities in the source code of programs, written in C, C++, C# and Java. It works in Windows, Linux and macOS environment.
Let's calculate the return on investment from using the PVS-Studio static code analyzer in the course of development - first in the "skeptic mode", and then more realistically.
To determine how much money PVS-Studio will return, first we need to count what's the real cost (value) of a developer's working hour.
The fact of the matter is that it is not enough to just take the annual salary of a developer and divide it by 1900 hours of working time. By the way, the number 1900 is chosen rather arbitrary. The number of working hours per year is highly dependent on the country. For example, in South Korea in the year there are 2069 working hours, in Russia - 1974, in the United States - 1783 and in the UK - 1676. Nevertheless, the number 1900 is completely appropriate in terms of working week of 40 hours, and we will use exactly this number for further calculations.
So, why isn't it enough to just divide annual salary by 1900?
First, programmers, as any other employees of any sphere, make much more money than they receive with their salary, otherwise the business will be running at a deficit. Programmers need to be provided with a work area, Internet and cookies, you also need to pay rent and so on. Oh, yes, there are still financial rewards, corporate events, various bonuses.
With all that, a developer must be profitable, which means he should yield net profit to the company directly or indirectly. In practice, this means that the work of a developer, depending on the situation, brings in 2-10 times much money than it is spent on his salary. It is important to emphasize that developers are no different from any other salaried employees. There are some peculiarities related to outsourcing, but this is another story.
For skeptical readers we'll take the multiplier 2. Which means that a developer brings 2 times more money than it is spent on his salary. Actually, the company with such multipliers is teetering on the brink of break-even. More honest approach is to take a multiplier equal to at least 3.
What does this all mean? If a programmer fell out of the development process for 1 hour, the company has lost not an amount of money equal to one hour of his work, but in 2 or 3 times more.
There is a second c factor influencing the price of the present working hour. The fact of the matter is that an employee does not code 8 hours per day. It is inconceivable that a man just came in the morning and was dealing with code for 8 hours throughout the working day. A developer is working with Trello, participates in meetings, responds to letters in the mail, takes part in code-review. In the end, he need to go to the toilet and have tea :). In the best case he will work directly with code for 6 hours. If you are reading this text not in the "skeptical mode", you understand what actually 4 hours is much more plausible time.
It turns out that the cost of an hour needs to be multiplied by 8/6=1.33 (skeptical mode) or 8/4=2 (closer to the reality).
Now let's multiply the two discussed multipliers and get the final multiplier, by which you need to multiply the cost of an hour of a developer:
In practice, the coefficients will be a little bit greater, because we do not take holidays into account in the calculations.
Let's now see what it means for the company when a developer with an average salary of $74.000 per year falls out from a workflow for 1 hour. The annual earning of $74.000 has been chosen following the average salary in Germany according to the StepStone portal data for 2018 year.
Note. For a better understanding it should be noted that in fact the company can spend more than $74.000 on salaries. It should be noted that the company might make contributions to the various funds and pay different taxes. However, it is so incredibly dependent on country and taxation schemes that we won't even try to consider all these options. For simplicity, let's assume that the company does not bear any additional costs and spends on the salary of a developer just $74.000 a year. We decided to note it, that we round numbers not in favor of PVS-Studio.
If the salary is $74.000, the hourly rate will be $74,000/1900 = $39. It turns out that if a developer gets distracted on fixing an error for 1 hour, then the company will not be able to earn:
This is the real man-hour cost (the value of) one hour of a developer when he is doing something useful.
It is very difficult to tell for sure, how many hours per year PVS-Studio will save when finding errors in the early stages. Errors can be very different. A developer can notice some of them himself and immediately fix them. Nevertheless, sometimes a bug can distract a developer from useful activities for a few days.
On the basis of empirical considerations for sceptics, let's say that the analyzer will save at least 2 working hours of a developer a week, delivering him from the need to look for bugs found by unit tests or a test department. Yes, fixing a bug itself usually takes minutes, but as for the attempts to reproduce the problem, conversations in a bugtracker, test runs, merges and so on, it will easily take these 2 hours.
Two hours mentioned above is a skeptical option, actually it can take much more. Bearing in mind that sometimes the analyzer can prevent hard reproducible heisenbugs, the average value can be definitely specified as 3 hours.
There are approximately 50 weeks in a year. During a year, the analyzer saves the following number of real developer working hours:
Then using PVS-Studio, one programmer with a salary of $74.000 will return to the business each year:
Now let's take a typical team of 10 people. Having introduced PVS-Studio, we can expect that, thanks to the saved time, the team will be able to perform useful work that will cost:
So, let's now unite all this in a single formula.
Let's denote the annual salary of a programmer as S.
The number of developers in a team is N.
How we'll cite calculations for teams with a different number of developers in tables. The table shows the projected amount of money which a team of developers can make for a company if, in the course of the year instead of editing bugs, it will be busy with creating something new. These are the numbers that one needs to compare with the license price.
Table description. Top row: developer's salary per year. Left column: number of programmers in a team. Table cell: how much money the team will additionally earn for the company during the year, if instead of editing bugs (which the PVS-Studio can find) the team will be busy with useful programming.
Table for the skeptics (click on the table to enlarge):
Table N1. Skeptic. Red: using of PVS-Studio can be unreasonable. Green: using of the static analyzer is justified and useful. Blue: the usage is uniquely beneficial.
The actual table (click on table to enlarge):
Table N2. Reality. Red: using of PVS-Studio can be unreasonable. Green: using of the static analyzer is justified and useful. Blue: the usage is uniquely beneficial.
The second table, in our view, is valid, and it is reasonable to take this one into account when assessing the feasibility of the license acquisition.
Of course, the given calculations are appropriate not always and not everywhere. For example, if the price of bugs and vulnerabilities for the project is extremely high, there is no reason to connect the value of using PVS-Studio with salaries. In such projects one should assess the possible monetary and reputational losses and associate them with lowering the risk when using a code analyzer. This is its own story, and we don't know yet how to approach it from the point of view of calculations.
Also calculations might not work for outsourcing companies. This may not sound very beautiful, but such companies are interested to sell as many hours on the development, testing and maintenance as possible. In some sense, usage of the analyzer can even reduce their earnings. This is indirectly confirmed by the fact that among the clients of PVS-Studio there are no outsourcing companies. In addition, at a first glance, in such companies some strange processes can happen. At the time of lower activity, the company can take a project even at a loss. It's better than dissolve some developers on vacation. They would rather be busy with something.
So, even though the calculations may not be suitable for all companies, we hope that we managed to demonstrate how to approach the evaluation of the effectiveness of using PVS-Studio in terms of business as a whole.