Code for Christmas

Today our family gathered to celebrate Christmas on my wife's side.  After the usual amazing food and gifts, we spent time making room for dessert, with some going for a walk on the newly snow-covered trails of the woods, and others sledding.  My eldest nephew and I stayed back so we could listen for my youngest nephew, who was napping.  Our conversation, as it often does, went to computers.

"I've been reading about HTML."

"What did you discover?"

"Well, I was looking at this site.  It got me thinking.  How do you do what you do with computers?"

The easiest way is to answer this is to do something.

"Which websites do you use?"

"Google and Facebook, mostly."

"Great, let's start there.  Open Google.  Now let's look at the source."

It's been a while since I looked at the source for google.com.  Today, it's first necessary to beautify it in order to even read it.  Having taught him how to cope with minified source, we start scanning through.

"How many people did it take to write this?  Hey, what's this bit about iPad and iPhone?"

var l = "undefined" != typeof navigator &&  
        /Macintosh/.test(navigator.userAgent);  
var q = "undefined" != typeof navigator &&  
        /iPhone|iPad|iPod/.test(navigator.userAgent),

"Excellent. Let's use this code and do something."

Laying in front of us is a MacBook Pro, an iPad, an iPod, and an iPhone--toys of the various family members out on walks, laying there needing to be put to use.

"OK, how do I start?"

A minute later we have a fiddle going, and he's got the hang of the game.  I'm left to affirm his inclinations as he works out the logic on his own.

"What if we make a page that shows you a picture of the device you're using as soon as it loads?"

"I like that."

Before the other nephew's nap is done we have a piece of code that works, and works perfectly on every device we try.

The level of satisfaction he's left with, showing his parents on their return, is a gift I'm still cherishing.

Show Comments