Once upon a time, someone on Stack Overflow asked the question, “How to explain Dependency Injection to a 5-year old”
The author of the question was really just looking for a good simple explanation but the title had resonated with people and I was surprised to see that person after person had either declared it impossible or had made a snarky comment about child abuse or something. But the answer was really obvious so I posted my answer: http://stackoverflow.com/questions/1638919/how-to-explain-dependency-injection-to-a-5-year-old/1638961#1638961
But I couldn’t let that drop, so I thought about it and it occurred to me that there was a pretty good analogy in a child’s life to closures. So I wrote it down and sent it to the interviewer the next day, and maybe that’s why I got the job after all. But anyway, I give you closures for a five year old…
You know how you like to play Star Wars*? I know what you mean when you say you’re going to go do that and I can tell you to “go play Star Wars” and you understand me.
You can play it in different places, like over at Jimmy’s sandbox and it will be Star Wars on Tattooine or in your big box that is Jabba the Hutt’s palace, but you can always have your Luke Skywalker, Han Solo, and Darth Vader with you so that part stays the same as when you first played it in your own room.
*Substitute Barbie if you prefer.