Demo: Binary Numbers

If you teach Computer Science, chances are that learning about the binary numbering system is part of the curriculum at some point.

Why teach binary?

Some people question whether or not binary numbers should be part of a high-level curriculum, given the multiple layers of abstraction between, say, a webpage and the binary code that brings that page to life. I’d suggest that:

  1. Those multiple layers of abstraction / encapsulation are very much a part of computer science, and a perfect jumping off point for a conversation about binary numbers.
  2. Students should understand that binary numbers are at the heart of every computer. A great video for demonstrating how people used to have to program computers is this one, demonstrating the programming of an old 8080 microcomputer. Follow that up with a demo of high-level / assembly / binary version of a program, described here.
  3. Learning how to decipher a binary number is not that difficult, and provides students with a manageable gateway activity to the field of computer science.

Demonstration strategies

Binary numbers can certainly be displayed on a computer monitor or projected in front of the class. An interactive Python session works just fine:

>>> bin(13)
'0b1101'
>>> print(bin(13))
0b1101

A more visible and physical demonstration of binary numbers can easily be constructed using an outlet power strip, socket adapters, and low-wattage aquarium light bulbs (see parts list below).

This device can be easily manipulated at the front of the room, with individual bulbs easily turned on or off simply by screwing them in tightly (on), or unscrewing them slightly (off). Students can be asked to identify the decimal equivalent of a binary number, or asked to manipulate the bulbs themselves to produce the binary equivalent of a decimal number.

Conclusion

This inexpensive and physical, practical demonstration device can be used in the classroom, with parents, during open house events, etc. It has become a mainstay of every CS course I teach.

Parts List

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.