Now Reading
[Geekery] Programming 101: PB & J

[Geekery] Programming 101: PB & J

Whenever you meet someone new, one of the first questions that comes up is “What do you do?”

For me, the answer is programming.  For some, that brings to mind the classical TV/movie trope of Mountain Dew, thick glasses, a pocket protector and walls of unorganized computers and blinking lights.  For others, I instantly get slotted as someone who knows how to program VCRs and can fix their computer.

My hope for this series is to dispel some of the stereotypes surrounding programming, confirm others, and give you a chance to learn some programming skills of your own, if you’re so inclined.

Programming 101: PB & J

If you’ve ever been to a summer camp, or leadership training or anything that required team building, you may have done the PB&J exercise.

Everyone sits in a room facing a table, which has a jar of Peanut Butter, a jar of Jelly, a loaf of bread and a knife.  Usually the team leader sits at the table, and calls out the most confident person in the room.  That person sits in the front of class, with their back to the table, and has to give instructions to the person at the table, and get them to make a PB&J.

The twist is, the person at the table pretends be an alien and has no idea what a PB & J is (let alone a sandwich), is mute and can’t give feedback, only follows the instructions of the person who  has their back to the table, and follows them to the letter.  The person assembling the sandwich doesn’t know how to open the jars.  Doesn’t know how to use the knife.  Doesn’t know how to untie the twisty-tie holding the loaf of bread together, has no idea what “spread” means, etc.

OM NOM NOM…

If you’ve never seen this, it’s hilarious, and usually ends with the assembly person covered in PB & J, a mess all over the table, and a hungry audience.

The PB & J scenario demonstrates the need for good communication.  It also shows just how much we take our shared knowledge for granted.  When you read ‘PB & J’ your mind conjures a clear image of the item and I’m sure you’d have no problem making one in less than a minute, given the ingredients.

Unfortunately, computers aren’t so lucky.  They have to be instructed in every step of the process.

How to open the jars.  How to hold the knife (HINT: not by the sharp end).  How to extract the Peanut Butter from the jar.  How to spread the Peanut Butter such that the bread doesn’t get torn apart.  They have no idea that it’s better to pick up and flip the peanut butter bread, since it will stick and won’t fall off mid-flip like jelly will.  Don’t forget to close the jars, and clean the knife for tomorrow!

So, where am I going with this?

The same idea that’s at the core of the PB & J exercise is at the core of what programmers do.  They take an idea, break it down into super small & detailed steps, and they translate those steps in to a language that the computer can use.  Clarity, precision and speed are key, and doing those things well is what being a good programmer is all about.

Why programming?

  1. Computers are everywhere, or soon will be, and they aren’t going away any time soon.
  2. Everyone should have a basic, fundamental idea of how they work and how to get them to do whatever you need them to do.

The first point is, I feel, a fact.  Computers are in our transportation, our houses, hospitals, in our work places and in our pockets.  You’re reading this on one right now (unless you printed it out, in which case you still used one…).

I believe the second point for the same reason I believe everyone who drives should have a basic understanding of how their car works, and how to properly maintain it.  You’ve just spent wads of your hard-earned money on a machine that you will be using on a daily basis  You should know how it works, and how to keep it operating in a healthy manner.  More importantly, it has so much untapped potential that you can access once you learn how to communicate with it in a language it can understand.

Most hand-held devices are trying to bridge that barrier with speech-to-text features like Siri and other voice activated features.  While that’s fantastic for searching for information, or dialing a phone while driving, they’re rather limited in scope.

There may not always be an app for that, and when that day comes, knowing how to write an app or script to do that task will be important.  Luckily, the core of what a programmer does is take an idea, process or procedure, break it down, and translate those steps into a language that the computer can understand.

For today, I’d like to focus on that first part.  Taking an idea and breaking it down into lots of little, detailed steps.

Homework

Throughout the day, pause and take note of the actions you take.  Analyze those actions, and try to focus on the steps involved.  Try to think of every little thing you would have to tell a robot or computer in order to get it to do the things you’re doing:  Make a cup of coffee.  Drive a car.  Take a shower. Retrieve a beer from the fridge.

Write down the steps for doing something and post it below.

View Comment (1)
  • The interesting thing about the P&J experiment, is that is will work regardless of how clued in the confident person giving the commands is. If the Team Leader making the PB&J sandwich simply takes the step there given and divides it into several smaller steps. From there it is usually obvious where the language could be misunderstood.
    Example:
    “Wrap one hand around the jar and the other hand around the lid of the jar. Twist the lid counter clockwise.”
    The Team leader could break that down into these steps:
    1. Wrap right hand around peanut butter jar (assuming she even decides to know was a jar is)
    2. Wrap left hand around the jelly jar lid (opps!)
    3. Tries to spin the lid counter clock wise to no affect.

    The same can be said of programming. You need to literally define everything! Luckily, programmers that have come before us have defined quite a bit of stuff for us to use, looping back to Plarzoid’s idea of shared knowledge in a way. That’s why we’re not just working with ones and zeros anymore.

      

Leave a Reply to Jon Dosmann Cancel reply

Your email address will not be published.

Scroll To Top