As you can see, the calculation of the square root can be naturally decomposed into several sub-problems: How to say a guess is good enough, how to improve a guess, and so on. Each of these tasks is accomplished through a separate process, and the entire SPRT program can be seen as a family process (1-2), which directly reflects the decomposition from the original problem to the sub-problem.
The importance of this decomposition is not just that it breaks down a problem into several parts. Of course, we can always get a large program, and divide it into several parts: the first 10 lines, the next 10 lines, and then 10 rows and so on. The key question here is. Each process in the decomposition completes a work that can be clearly marked, which allows them to be used as a module for defining other processes. For example, when we define a process based on square Good-enough? , the square is seen as a "black box". In doing so, we simply do not have to pay attention to how the process calculates its results, but only the fact that it can calculate the square value. The details about how the squares are calculated are hidden away, and can be postponed until later to be considered. Is this the case, if you only look at Good-enough? process, rather than square is a process, rather it is the abstraction of a process, the so-called process abstraction . At this level of abstraction, any process that can calculate the sum of squares can also be used.
The construction and interpretation of computer programs
Process as a black box abstract