Indirection [0] is a quite big topic and applying it can result in both significantly improving the code and getting more problems than benefits. Therefore, the question is when indirection is appropriate. One opinion [1] is that
"We can solve any problem by introducing an extra level of indirection"
Another opinion is expressed in this post (avoid indirection). In the context of this example, indirection is related to the problem of modularization and separation of concerns. In particular, a typical question is whether we want to hide some details or use the functionality directly.[0] https://en.wikipedia.org/wiki/Indirection
[1] https://en.wikipedia.org/wiki/Fundamental_theorem_of_softwar...