Putting the definitions for a specific task in one place makes it easier to maintain a program. With everything in one place, fixing an error means fixing it in one function, not four or five similar versions. Extending a function's capabilities, means fixing one function, not its related copies. And, changing a data representation means changing a general data-traversal function, not all those that came from the same template. Experience teaches us that maintaining software is expensive.
Programmers can reduce the maintenance cost by organizing programs correctly.
The first principle of function organization is to match the function's structure to the structure of its input data. If every programmer follows this rule, it is easy to modify and extend functions when the set of possible input data changes. The second principle is to introduce proper abstractions. Every abstracted function creates a single point of control for at least two different functions, often for several more. After we have abstracted, we often find more uses of the new function.