Thursday, January 26, 2017

Abstraction

Imagine that, here in front of me, I have a box called "Apples".
Someone will hand me an Apple, and I will place it in the box.
This happens twice, so now the box has 2 Apples in it.

But then someone hands me an Orange, and expects me to put it in a box. I can't put that in the box called Apples! It's not an Apple!
So I get another box, put it in front of me, call it "Oranges", and put the Orange in it. Great! Now I have a place to keep Oranges when they get handed to me.

Life continues for a while, with someone handing me an Apple that I put in the Apples box or an Orange that I put in the Oranges box. But then someone hands me a Pear. As you can imagine, I now have a "Pears" box in front of me.

And then someone hands me an Apricot... and I have an "Apricots" box now.

And this continues: each time someone hands me something new, I have to go get a new box and call it something new. Now I have a lot of boxes!

So all of this time while someone has been handing me Apples and Oranges and Pears and Apricots, once in a while they'll ask for one back: "Give me one Apple" they say, and I reach into my Apples box, pull one out, and hand it to them. "Give me the second Apple" they say, and I can reach down to the bottom of my box of Apples and pull out the next-to-last one there, because the one at the very bottom is the first Apple I put in there so this is the Second Apple.

But then they ask me for something I'm not expecting: "Give me the third thing I handed you." All this time, I've been keeping everything handed to me sorted by what sort of thing it is: an Apple, an Orange, and so-on. I have not been keeping track of when they handed it to me! The only way for me to do that would be to put everything in the same box, but I can only put something in a box if it is what the box is called!

The fix is simple: call the box something that can cover Apples, Oranges, Pears, and Apricots. I need a name for all of those things, so I grab a box and call it "Fruit". Perfect! Now we can put all of those Fruits into the same box. When they ask me for the third thing, I can hand it to them no matter what sort of thing it is. When they ask me for the second Apple, I'll pull out things until I find an Apple, then pull out more things until I find the second Apple and give them that one!




This is what we call Abstraction.

We find some way to call several different sorts of things by how they are like each other. They could all share the same color, or they all come from trees, or they're all food, or whatever! The key is that we can call all of them by that thing that makes them like each other, so we can make a box that uses that thing to call them.

When we need one certain kind of thing from our box of abstract things, we need to check each thing to see if they have the right thing we're looking for.