How to think like a program (or a programmer) when you make a peanut butter and jelly sandwich

So, if you’re like me, the first time you look at code, you will cock your head and let out a confused whine. “What is this gibberish?” you will ask. The short answer: definitions and instructions. Programs need two things: definitions and instructions.

On a recent family trip, the fiancé and I were trying to explain to my dad something about programming. He kept on getting stuck on one particular point, until my mom piped up with, “Because computers can’t climb a chain of inference.” (Side note: This is not strictly 100% God’s own truth, but, as with most basic programming courses, we’re going to hand-wave that bit. You just need to be a damn good programmer to make it so. Most of us are mere mortals and cannot whip up a program in 2 hours that will turn your computer into HAL. Be thankful.)

I started to describe it in these terms: think of telling someone how to make a peanut butter sandwich. Now, think of how you’d tell someone to make a peanut butter sandwich if, like Amelia Bedelia, they could only follow instructions literally. (Put jam on the bread? Better hope you told them to get out the bread, uncap the jam, and use a knife, and that you’ve told them how much jam to put on.) Now imagine that not only does this person follow your instructions purely literally, but they do not know what bread, peanut butter, and jelly are. They don’t know that there are things that you spread on bread. They don’t know what a sandwich, a knife, or a jar are. Like Jon Snow, they know nothing.

*sniff* Nobody ever taught me how to make a PB & J... *cries*

*sniff* Nobody ever taught me how to make a PB & J… *cries*

And not only that, but if you give the person something unexpected, the world will end. It might end quietly, or it might end loudly.

For example, imagine going to your favorite deli and ordering a turkey club. The person at the counter brings you a brick. You will probably point out their mistake and ask them politely to bring you the turkey club you asked for. They will promptly go out, club the turkey with the brick (*rimshot*), and make you your sandwich.

On the other hand, a program in the same situation, if it has not been told that, presented with anything other than a turkey club, it should, in fact, ask again for a turkey club, will probably do something at least akin to one of a few things:

a) Try to eat the brick, breaking all its teeth in the process.

b) Stare at the brick quietly. It might eventually leave money there, and return and tell you that lunch was fine, only to pass out later from hunger. Or it might just stay at the deli until you come to get it, by which time, it has also probably passed out from hunger.

c) Glance between the brick and the person at the counter wildly, slowly freaking out more and more until it runs out of the deli screaming.

d) Give a blood-curdling scream, smash the display case with the brick, and collapse, sobbing incomprehensibly.

Now, if the program were presented with something edible, depending on what exactly you told it to expect, it might be able to cope. If you presented it with some other kind of sandwich, you’re probably in much safer territory. So, yeah, computers… aren’t smart. They need telling what to expect, and what to do if it’s not given exactly what it expects (or rather, when it’s not given exactly what it expects. Always assume someone will give you bad input).

Back to our peanut butter and jelly example. If you’re telling someone who at least knows what bread, peanut butter, jelly, sandwiches, bags, jars, and knives are, they can probably infer how what you mean when you tell them to put peanut butter and jelly on the bread, put the peanut butter and jelly sides together, and enjoy. Heck, they might even know how to go to the grocery store for those things!

So, let’s try this thinking like you’re telling a program who knows none of these things what you want and how to get it. First, procurement of the goods. For simplicity’s sake, we’ll assume you don’t have to completely build a house from scratch, order some silverware from Macy’s, or get transportation to the store. However, you already wind up needing to tell the program a lot of things:

1) Where the store is, and how to get there and back.

2) What peanut butter, jelly, and bread are, what kinds you want, and where they are in the store. (You probably also want to tell the program how to ask for help and process that help in case they’ve moved things around, lest your program follow option d of our deli example.)

That doesn’t seem like much, but unpack it—it’s a lot.

Moving on, your program is back, and it has the correct items. The store remains standing and unscathed, so you don’t have to deal with an angry shopkeeper. Now the real fun begins. The instructions will probably be something like the following.

1) Take the twistie off the bread bag. Open the bread bag. Pull out two slices of bread (or, more accurately, while you have less than two pieces out of the bag, pull another piece out–yay, control flow!). Close the bread bag and re-twistie the bag.

2) Find the peanut butter. Unscrew the lid from the jar of peanut butter. Use the knife to extract the desired amount of peanut butter, being careful not to fling it at the ceiling. Use the knife to spread the peanut butter on one side of one of the pieces of bread. Set that piece aside. Screw the lid back on the peanut butter jar.

3) Find the other piece of bread. Repeat the same instructions from two in order and exactly once, replacing every instance of “peanut butter” with “jelly”. (Yay, refactoring code!)

4) Take the two pieces of bread and put the sides with the spreadables (yay, interfaces and/or abstract classes!) together, such that the bread is oriented in the same direction if it has a shape such that this would be a good idea.

Okay, so that’s four steps, but that’s four long steps. Steps full of things you and I don’t have to tell each other when we yell “Make me a sammich!” Aren’t you glad you don’t have to describe literal-word-for-literal-word how your sammich needs to be made each time your robot servant makes it for you?

This is what programming is: breaking down a problem into all the requisite parts, including the ones you know are small and stupid but actually could really botch the entire thing if left out or messed up. It’s problem-solving in a way or on a level most of us just don’t need to think about in our day-to-day lives (well, unless we’re programmers). That doesn’t make programmers smarter or better or more observant, though; it just makes us people who have probably gone to school to more or less re-learn how to do these things with some amount of finesse and elegance, rather like any degree. It’s a specialization, and it’s certainly not for everyone, but it’s a good exercise in learning a certain way of thinking, and understanding why it is that that program is running out of the deli screaming when presented with a brick.

Figuratively speaking, of course.

Politics gets lady bits (sort of) right for once

So, Mike Huckabee recently said something about how women who want birth control can’t control their libido or their reproductive system.

I find this hilarious because he’s spot-on; just not in the way he thinks he is.

I mean, no shit; libido is not a static thing!

Really, how many times have we heard the defense of a rapist (NOTE: I chose my word with care here, because I’m pretty sure I have heard this exact thing heard used in the defense of both male and female rapists) say “I just couldn’t control myself”? Sure, you can’t control who you find attractive. Most people have someone. I had cute teachers in high school. I’ve had crushes. Just because you can control the actions resulting from that—Which, hey, is exactly what most of these women are doing, I’m pretty sure; it’s just that their control results in consensual sex that is far less likely to produce children. Where’s the condemnation of the guys who engage in this? Oh, right, they’re “sowing their wild oats”… which is code for “can’t control their urges”. Forgot about that. My bad… *coughchokeDIE*—doesn’t mean you can control exactly when you’ll find yourself ready to go. Yeah, women are supposed to have that famed “on/off” switch for those *ahem* romantic feelings, but Hollywood lies to us about a lot of things, and I’m pretty sure this is no exception…

To be clear, I believe that men are just as capable as women of controlling their urges. People are, by and large, pretty decent. For some reason, we give the ones that aren’t the most press. Kinda sad if you ask me.

(What I find absolutely hilarious is that I’m watching this little exchange in the 1993 “The Three Musketeers” right now:

Aramis: [teaching female student about the fall from the Garden]

Student: [leans over and kisses him]

Aramis: Madam, I’m flattered, but I am here to tutor you in theology.

Student: Forgive me, Monsieur Aramis, but when you started talking about original sin, I lost control and became impassioned. It won’t happen again; go on.

Aramis: [puts down Bible] Well, there’s nothing… unholy about… expressing one’s emotions. On the contrary, religion should be experienced in an all-embracing way. Feel free to express your spirituality.

Student: Yes, darling. [They start making out]

Husband: [Turning door knob] LET ME IN!

Student: [panicked whisper] My husband!

Aramis: You’re MARRIED?

Student: Yes, I’m married!

Aramis: Oh, we must pray for our sins. [They bow their heads; door bursts open, husband takes a shot at Aramis, who ducks] On second thought, God is often busy… [runs as Student tries to hold off Husband])

As to being unable to control my reproductive system, God, I only wish I could. I can’t just go, “Oh, hey, uterus, my homie; I had a rough go of it last month–think you can tone the cramps down? Actually, all you bits and bobs down there, can we just not do this this month? Actually, can we just not do this until I’m ready to have a baby*? That’d be swell, thanks!” (* Funny story: that’s actually how fertility works in Terre D’Ange in Jacqueline Carrey’s Kushiel series.) Is there some sort of black magic by which men control their bits and bobs? Given the conversations I have had with those of the biologically male persuasion, I’m pretty sure there isn’t…

Oh, right; they can’t actually control it and they’re sowing their wild oats. Anyway… *coughchokeDIEAGAIN*

More seriously, I can sort of see the point he’s making in his other remarks. I don’t agree with it, but I can see how he got his slant on it. The thing is, I don’t feel like a victim when I can make my own choices and when I’m not debilitated by cramps three days a month. (And apparently 3 days is me getting off lucky. Either that, or my friends have some really crappy luck…) I actually feel really empowered. Something about not having to excuse myself from work, especially in an industry that is still largely male-dominated, just makes me feel good. I mean, not that I try to wave banners and announce it to the world, and it’s not like the guys I work with ask or are jerks about me being female. It’s just one of those facts-of-life-that-we-just-really-don’t-want-to-think-or-talk-about things. As long as that’s understood, it’s all cool.

Rather like abortion, I’m not going to force birth control on someone who doesn’t want it; it should be a choice. It is that choice that is empowering. It’s a choice that does give me control over things I otherwise can’t control.

…At least we agree on that point?

What I’ve Learned In College

You learn a lot of things in college. Some of them will (hopefully) be pertinent to your future career. Some of them will make you a better person. Some will make you feel like you’re the worst person on the planet. Some seem like they’ll never be useful, but really will be.

In honor of my time at university drawing to a close, here are some things I’ve learned over the past four years.

–Food is a valid bargaining chip and can be used in place of money with the average college student. This is also more or less true of alcohol, but food will by and large make you far more friends, at least in my case.

–There are about 12 types of people you will meet in college, but each one of them is an individual.

–How to avoid La Rouchies.

–You’ll meet a lot of people who are just big high schoolers, or even big middle schoolers. At least one of them will be a professor or TA.

–Long weekends spent avoiding studying will allow for a lot of self-introspection. You will not always be happy with what you find, but you may also learn how to make peace with who you are.

–The quickest way from one end of campus to the other, excluding buildings that aren’t on campus proper. Like the ceramics studio. (Never had class there, and I’m thankful.)

–Everything you know is wrong, if only slightly.

–One does not magically become an adult by living on one’s own.

–How to get drunk neighbors to shut up/how to stand up for yourself when your neighbors will not shut up at 2 AM during finals week.

–How to manage with communal showers.

–Relatedly, that there are such things as paper towel dispensers and they produce these magical sheets of recycled wood product that can be placed between your hand and the hair clogging the drain.

–How to have fun on a budget.

–Dorm wifi sucks.

–Off-campus wifi really isn’t any better, and you have to pay more for it.

–How not to set off the dorm fire alarms while cooking.

–How to not be that jackass who sets off fire alarms at 2 AM sending everyone else out into the snow and ice in their goddamn pajamas. (Still haven’t gotten over that.)

–I can’t pull all-nighters.

–I can, however, talk until 3 AM with friends while trying to calm down from a panic attack.

–How to not live in an isolated bubble so that the real world seems like only a dream.

–How to cut coupons like a madwoman.

I would conclude with mushy stuff about how I have awesome friends I never want to lose touch with. This is very true, and while some of us are scattering to the four corners of the earth (or at least the southwest corner of the U.S.), we already know we’ll be staying in touch, so I’m not going to write sappy comments that would make me bawl my eyes out. There will be enough of that after I get my wisdom teeth out.

Weird keeps us together

The boyfriend and I have some pretty weird (or at least random) conversations, as evidenced by “What’s Your Slug Doing?” In fact, something weird slipping into almost every conversation is the norm for us.

Take, for example, the mantis shrimp. It’s a pretty awesome critter, and, if The Oatmeal is to be believed, pretty terrifying. I want one. The boyfriend knows this, and yet, for some reason, he insists that this is not a good idea; something about how it can (among other things) break aquarium glass. I told him I’d be careful with it—I’d wrap its scary bits in, like, diamond or something and feed it by hand. He said that it wasn’t me he was worried about. Which is probably true, though I can be a bit of a klutz, myself. So maybe I can get a mantis shrimp plush or something—maybe a little glass figure. I’m sure such things exist.

There was a detour somewhere in there about how I would present the mantis shrimp much in the same way as those “It’s dangerous to go alone; take this!” moments, which led to Link (yes, of Legend of Zelda fame) smashing his way through everything with a mantis shrimp because they are just that badass. Despite all my tearful (My eyes were watering for some unrelated reason. They do that on occasion.) pleas, and all my awesome ideas, though, the answer still remains a very firm “no”. (Thankfully, my other pet requests trend towards normal: a corgi, a Maine coon cat, and a lionhead bunny. Bunnybunnybunny…)

On occasion, these pleas devolve entirely into some other nonsensical argument that eventually leads to utter ridiculousness. I think one of my favorite non-sequitur comebacks at the moment is “I EAT YOUR FACE!” I’ll leave it to your imagination just how that goes down.

Another slightly more playful one is “husky kisses”. If you’ve ever seen pictures of husky puppies, or seen them in action, you know that they love to nip each other’s muzzles. (Even if you have seen it, you should look at those pictures. SO CUTE.) If I recall correctly, this is actually a holdover behavior from wolves. I certainly don’t see this happen nearly as often with dogs that are less closely related to wolves, anyway. However, since humans don’t have the same sort of structure, the next best thing is clearly a nip on the nose, somewhere between a little peck of a kiss and “I EAT YOUR NOSE”.

After one of those happened, we somehow made the jump to the “insane sadistic psycho surgeon” from the boyfriend’s information ethics class. It was a pretty messed-up example taken to extremes, but it’s clear what the point was: pure hedonism is bad. (Because apparently, this is not entirely self-evident…)

So yeah, we’re weird, the boyfriend and I. It’s part of the attraction. It’s one of those things that makes our relationship (and, to be honest, most of my friendships) work. Being accepted for (or despite) all one’s flaws is astoundingly freeing. That doesn’t mean we shouldn’t work on them, but it does mean that we can have a lot of fun along the way.

Computers Confound Me

I’m a computer scientist.

I will be a certified (well, Bachelor of Science’d) computer scientist in 3.5 weeks, God willing and the creek don’t rise (or rather, my grades don’t fall…).

As such, you’d think I’d be… oh, what’s the phrase… computer savvy?

I am, to an extent. I mean, I can do your basic install/uninstall, run most programs, and, well, program. I don’t really do hardware; it confuses me. I get how it works on a high level, but there’s something about circuits that just doesn’t work for me. I’m savvy enough, anyway.

Until I got the new laptop; the learning curve shot way the heck up there.

Whereas my old laptop had me press the function key in order to use the f1-12 buttons as they were intended, this new laptop (rightly, I think) has me press the function key in order to do the other functions those keys provide. This is supposed to make things a lot easier. Usually, it does. The only thing that’s difficult is hitting f11 and f12 with one hand.

The fact that I can actually hit through f10 should have clued me in, though. The sensitivity of the touchpad and keyboard on this thing is kind of insane. I’ve unintentionally hit keys that have resulted in all kinds of funny behavior, but never until today, did it result in the disappearance of my cursor, or rather, the functionality of my touchpad in general.

I gather that the f9 key’s special function is meant to turn off the touchpad now, but at 2:30 today, that was not the case.

I was in class, trying to take notes, and I knew I’d hit a jumble of keys. But suddenly, my cursor froze and then disappeared. This was not good. I tried frantically to make it reappear by tapping and clicking my touchpad, but no such luck. Since my computer had just started up after an update, I wondered if one had screwed things up. (Wouldn’t be the first time…) After several restarts and a lot of mental swearing, I started looking up why my touchpad was nonresponsive. (I somehow managed to figure out how to navigate through everything without my cursor.) One site suggested that I hit f9.

I looked at the key, and a very, very profane thought went through my head. The little icon with a slash through it was the (censored) touchpad! I must have hit it along with the function key and there it went.

Times like these, I’m really not sure how I made it through the last 4 years. Really. But I guess we all do stupid things, and it’s what, if anything, we learn from them that matters.

I learned what the f9 key does today. What about you?

Everything I ever needed to know started out a lot like this…

Everything I ever needed to know started out a lot like this…

I should hope it’s patently obvious that this person is just having fun, but just in case it isn’t, now you know.

We’ve all felt like this was the explanation for something at one time or another. There seemed to be no particular rhyme or reason to the explanation, and it totally seemed wrong in your head, but the speaker was all, “Trust me; I’m a professional.” Well, the going joke among my science friends (as I’m sure it is at universities everywhere) is that they call it a B.S. for a reason. I mean, at the end of the day, a lot of what we think we know is just really, really well-educated guesses based on years of observation and experimentation, and we just haven’t pushed the right, or rather, wrong buttons yet. Or rather, if there are any wrong buttons, and there may very well not be, we haven’t pushed them yet because out of a set of a googol or so buttons, finding the one that doesn’t behave as expected is well beyond Herculean in terms of tasks.

Yes, there are irrefutable facts in this world, and math is a lot of how we understand these things. Math, at its core, is immutable. But some of the fields that use it aren’t yet because as much as we know, we also know that there’s some part of it that we don’t know because we haven’t been able to explore it yet. Current theory seems to cover everything we’ve discovered so far pretty well, though. However, I get the feeling that a lot of people don’t really get what a theory is in scientific terms. It’s basically one step down from God’s own truth, if I’m putting it in layman’s terms. As Wikipedia puts it (which is accurate, and better than what my sleep-deprived brain can come up with right now): “In modern science, the term “theory” refers to scientific theories, a well-confirmed type of explanation of nature, made in a way consistent with scientific method, and fulfilling the criteria required by modern science. Such theories are described in such a way that any scientist in the field is in a position to understand and either provide empirical support (“verify”) or empirically contradict (“falsify”) it. Scientific theories are the most reliable, rigorous, and comprehensive form of scientific knowledge, in contrast to more common uses of the word “theory” that imply that something is unproven or speculative (which is better defined by the word ‘hypothesis’). Scientific theories are also distinguished from hypotheses, which are individual empirically testable conjectures, and scientific laws, which are descriptive accounts of how nature will behave under certain conditions.”

This, my ducks, is why I was absolutely pissed when the 2011 Miss America contestant from my home state decried teaching evolution in schools because “we kinda want to stay away from little theories … I believe in the truth and the truth only”. (And this is where my roommate will jump in and tell you that it’s okay for definitions to have multiple definitions, even when they contradict each other. Considering how important it is to know the difference here, though…) Okay, so, in that case, we definitely shouldn’t talk about relativity, gravity or a lot of other things that we take as truth simply because we haven’t seen proof that we’re wrong yet. Good to know. None of these things are just “little theories”. (Side note—I am aware that some parts of evolution are rather more shaky at least in people’s minds because, let’s face it, it’s hard to test a process that takes that much time in such a way that it can produce results in a reasonable amount of time. However, I think we can all at least agree that there is pretty strong evidence that micro-evolution has occurred and continues to do so.) We might not fully understand them yet, and we may never fully understand them, but that doesn’t mean they hold no weight.

Unlike this explanation for how algebra works.

The science (or lack thereof?) of attraction

In the beginning, there was the sun and the earth. The earth said, “Hey, you’re pretty hot”, and the sun replied, “Thanks—you’re pretty cool yourself.” And thus, the moon was born.

Okay… That might be a little wrong.

Okay, maybe a lot wrong. Nobody ever said I was a genius! Don’t judge me!

*deep breath*

Anyway, attraction is weird. I’m sure we all know this.

It should be relatively straightforward, though, right? I mean, the way everyone talks about it, you find someone who instantly agrees that you would have beautiful babies, you get married, and… happily ever after. BAM! End of story.

Hah… Hah Hah… Haaaaaaahhhhhh…

Yeah, not gonna even try. Just not gonna… no.

Attraction is complex. Attraction can be messy. Attraction can be unexpected. Attraction can be physical, emotional, spiritual, intellectual, or some combination thereof. It can be between people you’d mistake for twins, or it can be between complete opposites. (Jeez, I’m starting to remind myself of Yvaine’s lines about how strange love is in the movie version of Stardust. Which is amazing, by the way.) And yet, we’re told that attraction is primarily biological; primarily for the source of finding someone whose genes, when mixed with yours, will produce strong offspring who will in turn pass on those strong genes… you get the picture.

Already, though, there’s a few things wrong with this. The most obvious thing is that some people, no matter how much sexual attraction they feel to others, don’t want/can’t have kids. Even when they’re biologically capable of having kids, some people just don’t feel they would be good parents. Some just don’t want to raise kids. Whatever their reasons, they’re completely valid. I’m not even gonna bring up the whole same-sex attraction except for to say that I firmly believe this is a biological thing—not a choice at all—and their relationships are just as real and valid as any loving heterosexual couple, and that’s the end of that.

Second, the strongest genes will be the ones that win out over time, it’s generally true; however, they won’t always win out in a given generation for a given couple. For instance, a lot of people wind up needing glasses at one point or another. But I guess that’s something of a given, and so not seen as a disadvantage, since we have the technology to correct it, more or less. Here’s a more personal example: the boyfriend is hard-of-hearing. When he’s not wearing his hearing aids, I have to speak louder than I would normally (and I have been told I am loud normally) in order to make sure he’s got what I’m trying to say. There’s no cure for the specific cause, so you’d think he wouldn’t be “prime mating material” or whatever. (Gives me the willies referring to him like that! If you’re reading this, dear, I hope you’re laughing at my attempt at silliness and not face/palm-ing at it. It gets better, though! Just read on!)

Newsflash: I don’t love a lot of people who have perfect hearing. I don’t dislike a lot of people who don’t. In fact, part of the attraction (not a turn on, but just a really, really cool thing) is that I now have an incredibly good excuse to learn ASL, which is something I’ve always wanted to do. But that’s not all of why I’m attracted to the boyfriend—not by a long shot. In my opinion, he’s a really good-looking guy. (Though he did get his hair cut very recently and I really liked his hair a bit shorter than the length it was, but c’est la vie. He still looks good, and I love him anyway.) He’s smart. He’s caring, but not to the point where I feel smothered or like he thinks I’m weak because I’m *ahem* of the fairer sex. *cough*choke*DIE* I could go on, but I’m not here to bore you with all the reasons he’s amazing.

I get that getting together because you actually like the other person is something of a newcomer as far as common institutions go. But when you think about it, you’re still getting something out of it, right? You’re getting someone who is in all likelihood willing to help you out, and who you will help to support. You’re getting someone who will care for your emotional needs as you will for theirs. It’s not a bad deal!

What I’m trying to say is that, anymore, genes aren’t the be-all-end-all of getting together. That’s not to say that we should ignore the child-bearing/-rearing factor completely. In fact, we shouldn’t ignore it at all—it’s just that there’s so much more than science can really quantify (at this point, anyway) about attraction. The number of times science has told me I’m apparently attracted to the wrong person is laughably (and at the same time scarily) high. We’re attracted to who we’re attracted to, no matter how much science tells us we shouldn’t be. I’d like to think it’s a little magical, myself. As long as nobody’s wrecking anyone’s relationships, why should we really care what’s behind it?