ELI5: Explain Like I'm 5

Indirection

Imagine you have a friend who knows the way to your favorite toy store. You want to go to the toy store, but you don't know how to get there. So, you ask your friend to show you the way.

Your friend doesn't take you directly to the toy store, instead, he takes you on a different route that eventually leads to the toy store. Your friend is using indirection to get you where you want to go.

In computer programming, indirection works the same way. Instead of directly accessing a specific piece of information, indirection uses a different path to get there.

For example, let's say you want to know your age. Instead of directly checking your birthdate and subtracting it from the current date, you may use a variable that holds your birthdate and subtract it from the current date. This variable is an example of indirection as it points to the location of the birthdate.

Indirection is important in programming because it allows for flexibility and abstraction. By using indirection, programs can easily adapt to changes without having to hard-code specific details. This makes programming more efficient and adaptable to changes.