Modern software development is inseparable from iteration, especially Internet software development. Rapid delivery and rapid iteration based on requirements have almost become the foundation of software success.
But does iterative development and demand changes mean that it is neither necessary nor possible to make a good design at the initial stage? What are the limitations of iterative development? If the software architecture requires significant changes, when will the reconstruction time be? This article attempts to give a perspective on these problems.
To illustrate this problem, we first turn software development into a mathematical problem. VectorW
To indicate the software status, VectorY
Indicates the ability of the software to meet the requirements,Y
AndW
Is defined:
Y
= F (W
)
The goal of software development isY
The value is large enough to calculateY
The maximum value in mathematics. Iteration Optimization in mathematics is very similar to iteration in software development. Assume that for the nth released software version, the software status isW
N, the relationship between two adjacent software versions is:
W
N + 1 =W
N + ε limit F (W
N)
It is the size coefficient of one-step iteration. When F (W
N) is f inW
The gradient in the N State indicates F, that is, the direction of the maximum change rate of the ability of the software to meet the demand, and the size of the change rate. The concept of gradient is very important. It points out that in the software iteration stage, although many functions can be upgraded, we should choose the most obvious feature upgrade direction under certain changes.
When gradient F (W
N) when the value is 0, the software iteration is stable. At this time, is the software perfect? Probably not, because this iteration method can only ensure that the local optimum state is reached, not necessarily the global optimum or the state close to the global optimum. When the software reaches the local optimal state, no matter how iterative the software can no longer meet new requirements, this requires large refactoring.
After a large number of incremental iterations, it is determined whether the software is in a poor local optimal state or in a global optimal state or near the global optimal state, that is, it is determined by the first several versions of the software.
For the sake of simplicity, the following is the state of the softwareW
Is one-dimensional. In one-dimensional scenarios, there are the following:
In the middle, the red curve reflects the changes of the software's function size with the software's status. At the beginning of software development, in order to meet initial needs, we may choose point A on the curve as the initial version.
As users increase their demand for software, we will start from point A and iterate along the rising direction of the curve. This is the most exciting stage in software development, because each step is a small upgrade, will bring about tangible improvements in functions. The function improvement efficiency is determined by the derivative of the curve at this point. In reality, because the software's lifting curve is not as smooth as it is, in addition to the function upgrade, there will still be many small refactoring.
When the software status reaches the B point in the curve, that is, the local optimum state, the software can already meet many functional requirements. However, the most painful stage of software development has arrived, because the demand is still increasing, but there is no way to upgrade the software. It is inevitable that a large architecture is rectified. After a large reconstruction, the software may reach the point C in the curve. At this time, the functions of the software may be slightly weaker than those of the old version, but after a series of iterations, the functions of the software will go beyond the best state of the old version, close to or reach the D point in the curve, that is, the global optimal state.
from the perspective of this article, we can see that rapid iteration, coupled with small refactoring, is not omnipotent, it can only ensure that the software reaches the local optimal State determined by the initial design.
in practice, software development is more complex, and the curves are not as smooth as they are. The same initial state may correspond to many local advantages. The significance of a large number of minor refactoring lies in that it avoids software from falling into a poor local optimum.
the wisdom of software design is largely reflected in the design of the initial architecture. For a good software designer, a point may be used as the initial design of the software, so as to achieve the optimum state of the software. An experienced and superior software designer is more likely to choose point C as the initial design, so as to achieve the global optimum of the software or the state close to the global optimum Through iteration. Poor design leads to the E point in the curve, a poor local optimum.