Search code examples
computer-scienceindirection

What does "level of indirection" mean in David Wheeler's aphorism?


I've read this quote in a book:

There is no problem in computer science that can't be solved using another level of indirection.

Can someone explain that? What does "level of indirection" mean?

From what I understood, indirection is a fancy name for using a pointer of a value instead of the value itself. Please clarify this for me.


Solution

  • "Indirection" is using something that uses something else, in its broadest sense.

    So your example, using a pointer of a value instead of the value, fits this definition at one level. The pointer is the something and the value is the something else.

    Typically this is something larger in scope:

    • Using a web site to graphically display the data generated by an XML based service. Here the web site is the something and hiding behind it is the data which is the something else.
    • Using an operating system to access the display screen. Here are two layers, at least of indirection. The OS uses the screen driver. One something using a something else. Then the screen driver talks directly to the screen hardware causing it to make tiny dots of light here and there. The driver is the next something using the something else which is the hardware.
    • It is not uncommon for one API to deal with something on a high level and that API deals with the same thing on a lower level. Again a level of indirection is added on top of the low level API and we call it the new, improved API.

    This last example, perhaps, explains the "why" of it all.

    As we work with something we master it and learn how to abstract it to a higher level of abstraction, thus a new level of indirection is needed and we can solve bigger problems faster by offloading some of the work to the new API.