# Binary Code

For my computer science class, Unit 1 is going to be about how computers work and how they use data.  I first gave a poorly-written pre-test. It contains bits of recall and procedural knowledge and is not a test of critical thinking or problem solving. But I gave it because writing the assessment helped guide me in understanding the scope of Unit 1, and it will give me at least some evidence of what kids learned during the unit… important stuff in a world of data-driven teacher evaluations. Plus, it’s easy to grade, important stuff in a world of 160+ students.

Computer Architecture and Data Pre-Assessment

I made a decision to start by introducing binary code and the rationale behind it: that it’s easy for a computer to “tell” if electricity is flowing or not flowing, and harder to decode an analog value – so a code based on switches that turn on and off makes a computer’s job easy.

I showed the kids a ribbon cable.

There are a few dozen wires running parallel to each other. Each one can have an electrical pulse that is either on or off – a 1 or a 0. A code made up of 1’s and 0’s goes through this ribbon cable. You can send any information you want if you can write a code for it made of 1’s and 0’s.

I held up a card, blue on one side and white on the other. I asked the kids if I could answer a yes/no question with it. They agreed pretty quickly that blue might be yes and white might be no (or vice-versa).

Next I asked them how many cards I would need to answer a question that I could respond with yes/no/IDK. At first the group thought I would need three cards, but when they thought about it, a group of kids persuaded everyone that 2 cards would do:

Yes = BB

No = WW

IDK = BW  (or WB)

So you can represent three different codes with 2 cards.  Next I offered a challenge.  I asked the kids if they could come up with a code for the digits 0-9 using the cards. They would have to use all of the cards for every code (after all, a computer can’t choose how wide the ribbon cable is).  They partnered up, and I said when they had a strategy, they could come to me and tell me how many cards they would need.  Some groups said they needed 3 cards.  Some said they needed 4 or 5 or 6.  One group said they needed 10 cards.

Me: 10 cards? You don’t think you could come up with 10 unique codes with less than that?
Student: Well, ok.  5 cards then.
Me: Here’s 5 cards.

After a few minutes, some groups who had originally taken 3 cards approached me and said they needed another card.

Me: You need one more?
Student: I can only get 8 codes with 3 cards.
Me: How many codes can you create with 4 cards?
Student: Uh.
Me: Let me know when you find out. Here’s another card.

Students developing binary codes for numbers.

I found out that I hate the layout of my room for group work. I’m in a computer lab with fixed workstations that I can’t move. All the stations face the front of the room. Just awful for putting your heads together over writing or for walking around between groups.  I was able to converse with some groups, but I wasn’t even able to see how many groups were disengaged or doing other things, let alone intervene with them – I need to think hard about how group work is going to work in there.

Here were some of the conversations I did have with kids.
Me: Were you able to make a code for 0-9?
Student: Yep. Here it is.
Me: I see. Very systematic approach. How many codes could you make total with 4 cards?
Student: 16.
Me: Tell me why you think so.
Student: Because you do 2 for the first card, and then x2x2x2. It’s like that problem where you have to pick how many outfits you can make with the 3 sweaters and 4 pairs of socks and so on.

I also found some misconceptions, and I will need to check back in the coming days to see if they’ve been fixed. Why does this student think this?
Me: Why did you need 4 cards?
Student: Because I could only get 9 codes with the 3 cards.
Me: Tell me why it’s 9 codes.
Student: Because that’s 3×3 which is 9.
Me: Can you show me what all 9 codes are?
But then of course we ran out of time before he could show me.

Anyway, when we were done, as a whole class we shared a couple of solutions and processed how many codes a computer could make with 4 bits (16), 5 bits (32), 6 bits (64), 7 bits (128) and 8 bits (256).  I asked the students if 256 seemed to be a common and popular number and if they were starting to understand why computers liked this so much.  It’s the number of different codes you can make with 8 bits, which makes a byte. 4 bits has a cool name too – it’s a nibble.

I introduced binary place value to the kids using a place value chart. I wish I knew how to have them “discover” this on their own (is it important for them to?).  I know I was taught directly, and I know my understanding of place value improved dramatically when I actually understood other number bases.

Binary Place Value chart.

I showed them how to convert some decimal numbers to binary, like 3, 19, and 30. The kids were SO excited by this. I told them we were going to do a worksheet tomorrow and their eyes lit up. I’m not kidding. A student approached me after class and said “I think I get this and I was wondering if you could give me a little extra challenge tomorrow.”   I said “Maybe another method like base 3? Where you have the digits 0, 1, and 2?”  He said “Yeah, I’d like that!”

I had a great day and I love my job.

Number bases are not explicit in the Common Core standards, which is a shame in my humble opinion. You feel so smart when you get a different number base. But if you wanted to do a lesson like this one and attach it to CCSS, you could use this one.

CCSS.MATH.CONTENT.7.SP.C.8
Find probabilities of compound events using organized lists, tables, tree diagrams, and simulation.