Skip to content

Rock Cairns and Magic Numbers

May 13, 2015

    
I should have brought a map. 

I ALWAYS bring a map. 

Okay, THIS time I didn’t, but almost ALWAYS. 

We were camped at Indian Springs at the top of Grove Creek Canyon in Pleasant Grove, UT. We needed to get to Battle Creek Canyon, the next canyon south. That was our ticket out of the mountains. 

Yesterday I talked about followers (How Do You Follow The Leader When You Can’t See The Leader.) I explained that if people stay on the path, they will arrive where they need to. Today, though, I had a different problem. There were multiple paths. And with a troop of boys depending on me to lead them through the rain and out of hte mountains, I needed to not be guessing. 

I didn’t bring a map because I wasn’t the designated leader when we started. I’m the assistant scoutmaster. The scoutmaster had been on this hike multiple times. Unfortunately his son had a championship soccer game that morning. Well, it wasn’t unfortunate for his son, but for us it meant the scoutmaster was up and out just after dawn, and we were left to our own direction.

The other assistant and I watched the clouds roll up the canyon as the boys broke camp. We were going to be hiking in the rain and the clouds were closing in fast. Visibility went from 5 miles to 50 yards in a matter of moments. 

We were not the only group that was camped at the springs. A trio of college aged kids had arrived after dark and set up their tents on the other side of the spring. I approached them as they were getting water for their breakfast. 

You guys know Battle Creek Canyon?

Yeah, we’re headed that way. 

Our guide had to head back early. I’ve only been that way once.

No problem. Head up the trail and we’ll leave cairns for you along the way.

My friend Dave is a great coder. (Heart, Mind, Code) He’s written thousands, possibly millions of lines of code. He’s been there before. Yesterday I asked him about magic numbers. 

Have you ever used magic numbers?

Yes, several. One I still use frequently (in non-production code) is 86400-that’s SECONDS_PER_DAY.

Magic numbers have an interesting role in programming. They aren’t really magic. They are values that are set by the programmer arbitrarily. Just like my friend might use the value of 86400 as the number of seconds in the day. The reason magic numbers are called “magic” is that a programmer just magically picks a number. 

If you read code that uses magic numbers, it often makes no sense. You come to a point where the programmer just assigns a value to a variable without any reason. But, as Dave’s example above shows, sometimes it helps to use a magic number. He could write some code that does the math of 

SECONDS_PER_DAY = SECONDS_PER_MINUTE * MINUTES_PER_HOUR*HOURS_PER_DAY 

If he included the above code anyone reading through it would understand his reasoning. But, if he simply puts

SECONDS_PER_DAY = 86400

it’s magic. It’s also simpler. 

What’s all this have to do with hiking in the Rocky Mountains in the rain? 

Cairns are like Magic Numbers. 

Our college friends headed off shortly after we talked. As the boys packed their gear and headed off into the rain, we followed the well worn path South. Like we had the previous day, our boys spread out along the trail. Soon the first fork in the trail appeared out of the mist.  

We had a decision to make; East or West? And there on the trail leading East was a pile of rocks, our cairn. And so it went for the rest of the morning. Each time we arrived at a crossroads, there was a pile of rocks carefully stacked one on top of the other indicating the direction we should take. 

Our unknown guide had left us markers to point the way. 

The cairns were clues from someone who had gone before. 

They were magic numbers appearing out of the mist; markers left to mark the path by those who’d gone before. They weren’t as good as a map, but they were close.

Rodney M Bliss is an author, columnist and IT Consultant. His blog updates every weekday at 7:00 AM Mountain Time. He lives in Pleasant Grove, UT with his lovely wife, thirteen children and grandchildren. 

Follow him on
Twitter (@rodneymbliss
Facebook (www.facebook.com/rbliss
LinkedIn (www.LinkedIn.com/in/rbliss)
or email him at rbliss at msn dot com

(c) 2015 Rodney M Bliss, all rights reserved 

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: