How many programmers do you need to support previously written code?

    Some time ago, a conversation took place between me and my good friend, in which the following phrases were heard:

    - The number of programmers will constantly grow - because the amount of code is growing, and more and more developers are constantly needed to support it.
    - But the code is aging, part of it is leaving support. The presence of some kind of equilibrium is not ruled out.

    Recalling them a few days later, I wondered if the code support, requiring more and more resources over time, could ultimately paralyze the development of new functionality, or would require an unlimited increase in the number of programmers? Mathematical analysis and differential equations helped to qualitatively assess the dependence of the volume of support on development and find answers to questions.

    The first question. Can support “eat” all development resources?


    Consider a team of programmers in which the number of participants is constant. Share of their working time$ \ mu (t) $ ($ 0 <\ mu (t) <1 $) accounted for by the development of new code, and the remaining fraction of the time $ 1- \ mu (t) $goes to support. Under the assumptions of the model, suppose that the first type of activity is aimed at increasing the amount of code, and the second - at changing it (correcting errors) and does not significantly affect the amount of code.

    We denote$ y (t) $ all code written by time $ t $. Considering the speed of writing code is proportional$ \ mu (t) $we get:

    $ \ frac {dy (t)} {dt} = a_0 \ mu (t);  a_0 \ in \ mathbb {R}, a_0> 0. $


    It is natural to assume that the labor involved in maintaining the code is proportional to its volume:

    $ 1- \ mu (t) = a_1 y (t);  a_1 \ in \ mathbb {R}, a_1> 0 $


    or

    $ \ mu (t) = 1-a_1y (t) $


    Where from

    $ \ frac {dy (t)} {dt} = a_0 (1-a_1y (t))). $


    We get a differential equation that integrates easily. If at the initial moment of time the amount of code is zero, then

    $ y (t) = \ frac {1} {a_1} (1-e ^ {- a_0a_1t}). $


    At $ t \ to + \ infty $ function $ y (t) \ to1 / a_1 $, a $ \ mu (t) \ to 0 $. 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$ h> 0 $ Since the code becomes obsolete and ceases to be supported, the amount of code requiring support at a time $ t $ equal to $ y (t) - y (th). $ Then

    $ 1- \ mu (t) = a_1 (y (t) - y (th)), $


    $ \ mu (t) = 1-a_1 (y (t) - y (th)), $


    a $ y (t) $ is a solution of a differential equation with a delayed argument [1]:

    $ \ frac {dy (t)} {dt} = a_0 (1-a_1 (y (t) - y (th))). $


    The solution to this equation is uniquely determined by setting the values $ y (t) $ "Before the beginning of time", with $ t \ in [-h, 0] $. Since no code was written before the initial time, in our case$ y (t) = 0 $ at $ t \ in [-h, 0] $.

    Let's look at a few examples. We will measure time in years, and the amount of code in thousands of lines. Then for$ a_0 $Values ​​of the order of tens are acceptable, we take 50 and 100. That is, in a year the development team will write fifty and one hundred thousand lines of code, respectively. For$ a_1 $ acceptable values ​​may be: $ 0.25 / a_0 $, $ 0.5 / a_0 $, $ 1 / a_0 $. This means that the development team is able to maintain the amount of code that it wrote for the year, with a quarter, half, or full workload. As the average life time of the code, let us set the values: 1, 2, and 4 years. Solving the equation numerically, we obtain examples of the behavior of the function$ \ mu (t) $ for some combinations of parameters $ h, a_0, a_1 $.
    image
    Function Behavior$ \ mu (t) $in the face of aging code has changed. The function has ceased to be monotonous, but fluctuations “calm down” over time, there is a tendency towards$ \ mu (t) $to some constant value. Charts show: the more$ h $, $ a_0 $ and $ a_1 $, that is, the slower the code gets older, the faster the development of new code occurs 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$ \ mu (t) $"Snuggled" close to zero. But this required the selection of very poor development quality indicators and long-aging code. Even in the lower left graph, a significant amount of resources remains for the new functionality. Therefore, the correct answer to the first question is more likely this: theoretically - yes, it is possible; practically - hardly.

    Questions that could not be answered:

    1. Is it true that $ \ mu (t) $ tends to a certain limit for $ t \ to + \ infty $ for all $ a_0, a_1> 0 $? If not for everyone, then for which?
    2. If the limit exists, then how its value depends on $ a_0, a_1 $?

    The second question. Can code support cause unlimited growth in the number of programmers?


    We denote $ q (t) $number of programmers involved in the development of new code. As above$ y (t) $ - the amount of code written by the time $ t $. Then

    $ \ frac {dy (t)} {dt} = a_2 q (t);  a_2 \ in \ mathbb {R}, a_2> 0. $


    Let the code support busy $ p (t) $programmers. C code aging

    $ p (t) = a_3 (y (t) -y (th)); a_3 \ in \ mathbb {R}, a_3> 0. $


    Where from

    $ p (t) = a_3 \ int_ {th} ^ {t} \ frac {dy (s)} {ds} ds = a_2a_3 \ int_ {th} ^ tq (s) ds. $


    If $ q (t) \ leq C_1 $then

    $ p (t) \ leq a_1a_2C_1h. $


    Thus, the answer to the second question is negative: if the number of developers of new code is limited, then in the context of aging code, 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 parameter values ​​corresponds to that expected for real systems; this speaks in favor of the adequacy of the models and sufficient accuracy to obtain qualitative estimates.

    List of 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 of the Center. 2004.

    Also popular now: