TITLE: A Fun Analogy on Garbage Collection AUTHOR: Eugene Wallingford DATE: December 10, 2004 3:46 PM DESC: Looking for real world examples of technical ideas can be a way to help students grok an idea. ----- BODY: Recently, jaybaz made an interesting analogy between garbage collection and, well, garbage collection:
What if Garbage Collection was like Garbage Collection?

Every Thursday morning at 6:00am, the garbage truck stops in front of your house. A scruffy man in an orange jumpsuit steps down, walks up to your front door, and lets himself in.

He walks around the house, picking up each item you own, and asks, "Are you still using this?" If you don't say "yes", he carts it away.

What if we turned the analogy around? Be sure to check out the reader comments to his article. When I teach design patterns, I like to make analogies to real-world examples, like television remote controls (iterator) and various kinds of adapter. I think a set of analogies for all the garbage collection techniques we use in programming language implementation would make a fun teaching tool. -----