Choose your own adventure, or if it’s sunny outside…

Go to the beach. This is how class started (more or less) last night. More or less. First, the stragglers from the class before slowly packed up their things, said bye to their friends in my class, and shambled off to wherever art/marketing/design/film students meander off to. Seriously, the concept of politeness is dead. I just talk over them and let those students who want to be distracted miss out on the opening remarks.

So the dreaded if/else statement was the topic du jour. I spent the entire evening writing on the whiteboard. No computer, no “start-up Flash and do what I say.” Well, I told them, “open up NotePad and type this in.” Some felt I meant a literal notepad and wrote only in the notebooks, even after I said, “you’re turning this in.” I have a few cellphone snapshots of people’s work, and I have to say, my eyes hurt, just a little, from fighting the urge to roll them up through all this.

So, sunshine and if/else. How else can you start explaining the concept, really? Most folks (I’m not part of “most folks” in this case) don’t think in terms of programming logic much. At least they don’t recognize it as such. I don’t usually either, but I have wondered, as I wait at a frozen bus stop in February, “if I hadn’t ducked into a Tower Records during a rainstorm in Santa Barbara back in 1994, would have ended up in Chicago in 2013?” The answer to that is probably “no.” That’s another story and I digress.

Simply put, choices we make based on variables in our lives are just like programming. Each leads to new choices and new paths to go down. Which makes <insert deity here> a snarky coder with chip stains on <his/her’s/its> D&D t-shirt. Or at best, we’re all living out the longest and oddest Choose Your Own Adventures books ever written:

If you want more coffee before your 11am meeting, turn to page 1173, if you think you can keep the yawning to a minimum, turn to page 1554.

Where was I? Oh yeah – if it’s sunny out, go to the beach, but if your boss sees you, don’t go to the beach:

var sunny:Boolean = true;
var boss:Boolean = false;
var beach:Boolean = false;

if ((sunny) && (!boss))
{
     beach = true;
}
else
{
     beach = false;
}

This took the better part of an hour to go through. I think by the end most were getting it – in the broadest terms. Next class, we’ll try and apply it to something more tangible than weather.

One thought on “Choose your own adventure, or if it’s sunny outside…

  1. Theresa Crout

    I wish this had been explained to me this way. I think it makes it much more relatable, and, more importantly, it’s easier to remember. I think you may be surprised. WIlling to bet that you have a student or two come back to you at a later time and tell you that they remembered this. Nice job, Mr Kotter.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>