grandma ruby program code success

Oh dear. I’m already in too deep.

(Written around midnight yesterday. Wait, is that today then?)

I just burned through three hours in 15 minutes.

Time has no meaning. I am as lost as left socks. Left socks are as meaningless as time. Unless they have toes.

Let me back up a bit.

Dev Bootcamp is billed as a nine-week intensive, but there are another nine weeks that often go unmentioned. I’m talking about Phase 0, the months leading up to the Bootcamp itself. During Phase 0, I’ll be connected with a moderator/mentor/assessment giver (via Google Hangouts) as I ramp up to speed through a series of increasingly difficult assignments, texts, games, challenges, and Oxford commas.

I haven’t started Phase 0 yet. I’m doing the pre-pre-work, the basic prep required for me to function during even the easiest part of this whole thing. And it’s a lot of fun so far. So much fun, in fact, that I just spent three hours working on things called Methods and String Formatting and Flow Control and it all took about 15 minutes to my giggling brain. Giggling like a kid, this tricksy brain of mine.

Tricksy kid, rabbits are for silly. Settle down.

I’m amped, charged, euphoric. I’m writing this from bed, because my body told me it was tired. But I’m in bed writing because my mind isn’t done being wide awake yet. I’m saying I’m too much. Here’s something fun that I learned today.

In Ruby, like in pretty much every programming language, there are conditional statements that create branching paths. You may have heard of the trigger words: if, then, else, etc. These branches can twist and turn inside another structure called a loop, which does stuff over and over until you make it stop somehow.

So here I am, reading about loops and ifs and bews and fouders and obscure Stephen King references (you’ll catch them if you search for them…EVENTUALly) and the book throws a curve.

The book, by the way, is Chris Pine’s Learn Programming, which you can read at the author’s site. It’s a fantastic resource. I’m only on chapter seven; start in on it today and you could get all caught up with me by next week, if you’re fast enough.)

I had just made a program simulating a grandma who’s hard of hearing. It asked for input and said “WHAT? CAN’T HEAR YA!” unless you typed in all caps. And then it would say something irrelevant and spit out a random year circa WWII unless you said “BYE.” It was fun and I was proud of myself.

Then the curve: how could I make the program pretend it hadn’t heard me say “BYE” unless I said it three times? I was stumped for a few minutes, and then I hammered out something that worked. It used three “while” loops, nested like Russian stacking dolls, and there was way too much repeated code, but it worked.

So I stopped being proud and let myself search for a more elegant solution.

Holy crap, was it ever elegant. These geniuses set a variable up and increased it by one every time “BYE” was entered. If the user typed something else, the counter would reset to zero. And that was the end of that. Sounds complex, but it was twice as easy to type and infinity times easier to read. I’d written a fourth grade acrostic. This solution was haiku.

So I played with that for a while, and I got comfortable setting that type of counted variable. And when the next challenge asked me to print all the leap years between any two given years, I used my newfound skill and aced it.

It felt really good. I feel like I could get really really ridiculously good. Looking past punctuation, I just now quoted Derek Zoolander.

See, that’s how you don’t talk to a computer. I’m learning that those idiots have no flair for lateral thinking or comedic nuance. They just do exactly what they’re told, perfectly, every time. Programming is a language of precision. That’s why I couldn’t quit until I found my own slice of elegance.

And that’s the story of how I lost track of time and found a whole new level of passion for this programming stuff. I’m so glad I jumped at this Dev Bootcamp dream the instant it crystallized in my skull. If I hadn’t, sure, I’d probably feel a lot safer, certainly way more secure in my fixed perception of intellect, my inflated ego, my complacency.

But I wouldn’t have felt like this. And this is an awesome feeling.



Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s