-->

Friday, November 7, 2014

Thought Experiments for the Layman II: What is a Human?

::continued from this post, where we are having a hypothetical conversation with a non-programmer named Jessica::

"Describe yourself."

"I'm currently in college studying..."

"Too specific. Lets say were a programmer trying to create a hyper-realistic virtual copy of you. Can you be a little more vague in describing your attributes?"

"Oh. Um, lets see, I'm a girl. 25 years old. Um, American. Brown eyes?"

"This is a step in the right direction. You're still being too specific however. Would you like to know how I would first describe myself to this magical matrix computer of ours?"

"How?"

"David Morris, is a lifeform."

"Huh?"

"Would you like me to be more specific?"

"Yeah, sure."

"David Morris, is a lifeform that happens to be a mammal."

"Well, duh, right?"

"David Morris is a lifeform that happens to be a mammal that happens to be a hominid that happens to be human. Are you starting to see a pattern here?"

"Oh I'm starting to get it now."

"In programming, starting with the details is a trap. The key is to be as deliberately vague."

"I think I kinda getting it?"

"For example, did you know that you share 92% of your genetic code with a mouse?"

"I do?!"

"Yeah, turns out that the code for 'This is the basic gist of how a blood cell works' is the same? You have code that tells you to breath oxygen and grow five fingers? Gasp, a chimp has the very same code in their DNA too! What a coincidence. You must be cousins!"

"Ha ha. Yeah right. I definitely see what your saying."  :)

"Exactly. First you tell the computer: This is a concept for a Lifeform. Here is code for ALL things Lifeforms share, no matter what. Load that in. This is a Mammal. Here is the code for ALL things Mammals share, no matter what. Load that in. This is a Hominid. Here is the code blah blah. Stack that on top of everything else. Etc."

"Oh I see!"

"Right. You're extending layers upon layers of instructions on top of each other, until you get to the final result of the thing you want.  You save the final descriptive stuff, like height and hair color, until the very end. Get it?"

"That makes sense!"

"Now if we want to add puppies to our super simulator, guess what? More than half the work is already done!"

"Woah! You're right. That would be convenient! Because we already told it what mammals are, so the basic idea that is should, I don't know, have a stomach to rub is already done!" :)

"Now you're getting it! This is the power of inheritance and encapsulation! Of being deliberately vague and ABSTRACT!"

"Cool!"

"So, describe yourself now."

"I am a Lifeform that happens to be a Mammal that happens to be a Human. Brown hair, brown eyes. Girl. 25 years old."

"Much better. Though it begs the question..."

"What?"

"Does you're being a girl really have to do with your DNA? Last I checked, I have testosterone, and so do you. And our brains and bodies both react to them the same. You have estrogen. So do I. And the code for how we react to them is exactly the same."

"Hmm."

"The only difference is in the amount of the stuff we get. Men have x50 times more testosterone methinks. While women have x20 more estrogen. Yet how a Human should react to them is the same."

"Hmm. Right. Gender is about our chromosomes right?"

"Precisely. The very last one. Here, you'd define, or encapsulate how a human should modify its production levels with what's known as an interface that a specific human instance to...equip you could say."

"Hmm?"

"So, when we tell the computer to make a version of you, we'd tell it something along the lines of Jessica = new Human (with brown eyes, hair, etc).

"Ok."

"For myself however, we'd have David = new Human (with blah blah details) and implements MaleGender behavior. We defined earlier a Gender interface, and all it does is 'modify the testosterone code (already present in all humans) so that its boosted by whatever percent."

"Oh, I think I see."

"So this is what Object Oriented Programming is all about. Does this help illustrate the mindset?"

"I think so. Thanks!"

~Code Crunch Corner~

No comments:

Post a Comment