Some time ago, a conversation took place between me and a good friend of mine, in which the following phrases were heard:
- The number of programmers will constantly grow - after all, the amount of code is growing, and more and more developers are constantly required to support it.
- But the code is getting old, part of it is leaving support. Even the presence of some kind of balance is not ruled out.
Remembering them a few days later, I wondered if code maintenance, requiring more and more resources over time, could ultimately paralyze the development of new functionality, or would it require an unlimited increase in the number of programmers? Mathematical analysis and differential equations helped to qualitatively assess the dependence of the amount of support on development and find answers to questions.
Question one. Can support "eat" all development resources?
Consider a team of programmers in which the number of participants is constant. Share of their working time () falls on the development of new code, and the remaining fraction of the time goes to support. Within the assumptions of the model, we assume that the first type of activity is aimed at increasing the amount of code, and the second one is aimed at changing it (correcting errors) and does not have a significant impact on the amount of code.
We denote by the entire amount of code written up to the point in time . Assuming the speed of writing code is proportional , we get:
It is natural to assume that the labor costs for maintaining the code are proportional to its volume:
or
Whence
We obtain a differential equation that is easily integrated. If at the initial time the code size is zero, then
RџSЂRё function , . And this means a gradual reduction over time of the development of new functionality to zero and the transition of all resources to support.
However, if in time code becomes obsolete and no longer supported, then the amount of code that needs support at a point in time equals already Then
а is a solution of a differential equation with a retarded argument [1]:
The solution of such an equation is uniquely determined by setting the values "before the beginning of time" . Since no code has been written before the initial time, in our case with .
Let's look at a few examples. We will measure time in years, and the amount of code in thousands of lines. Then for values of the order of tens are acceptable, we will take 50 and 100. That is, in a year the development team will write fifty and one hundred thousand lines of code, respectively. For acceptable values are: , , . This means that a development team is able to maintain the amount of code it writes in a year while being a quarter, half, or full time job. As the average lifetime of the code, let's set the values: 1, 2 and 4 years. Solving the equation numerically, we obtain examples of the behavior of the function for some combinations of parameters .
The nature of the behavior of the function in terms of aging code has changed. The function has ceased to be monotonous, but the fluctuations “calm down” with time, there is a tendency to strive to some constant value. Graphs show: the more , и , that is, the slower the code ages, the faster the development of new code and the lower the quality of the code, the less resources will remain for the development of new functionality. There was a desire to give at least one example in which “snuggled” close to zero. But this required the selection of very poor development quality indicators and long-lasting code. Even on the lower left graph, a tangible amount of resources remains for the new functionality. Therefore, the correct answer to the first question is rather this: theoretically - yes, it is possible; practically unlikely.
Questions that could not be answered:
- Is it true that tends to a certain limit all ? If not for everyone, then for what?
- If there is a limit, how does its value depend on ?
Question two. Can code maintenance cause an unlimited growth in the number of programmers?
We denote by the number of programmers involved in developing new code. As above - the amount of code written by the time . Then
Keep the code busy programmers. Taking into account the aging code,
Whence
If then
Thus, the answer to the second question is negative: if the number of developers of new code is limited, then in the conditions of code aging, support cannot cause an unlimited increase in the number of programmers.
Conclusion
The considered models are "soft" mathematical models [2]. They are very simple. Nevertheless, the dependence of the simulation results on the values of the parameters corresponds to what is expected for real systems, which speaks in favor of the adequacy of the models and sufficient accuracy to obtain qualitative estimates.
References
1. Elsgolts L.E., Norkin S.B. Introduction to the theory of differential equations with deviating argument. Moscow. Publishing house "Science". 1971.
2. Arnold V.I. "Hard" and "soft" mathematical models. Moscow. Publishing house MTSNMO. 2004.
Source: habr.com