How to Teach Data Types

I received this email from Terry Palmer, an instructor of CIS at Mayville State University. As a software development professional, the preparation of new graduates in this field for real world work provided by mainstream universities has often been very disappointing. I'm excited about things things Terry has been doing with his CIS students to pass on applicable, work-ready skills. If you or someone you know is considering going to college for a programming-related degree, you owe it to yourself to take a peek at Mayville State University. Here's an illustration Terry uses to impart the concept of "Data Types" to students who are brand new to programming:

I made a trip to Fargo last night to find some tangible things that will help illustrate data types and how they work. After much browsing around Michaels and Hobby Lobby, here's what I came up with:

Integer: a small round clear container that will hold pennies. I chose pennies because we like to count money. Number datatypes are all about counting and math. So when I add the contents of one container to another (or both to a third container), the result is the total that ends up in that container. Putting a white label on these containers where I can write the name of the variable would probably help illustrate further. For multiply, I could fill a container with the same number of contents as many times as I'm multiplying.

String: I picked up some aluminum wire and some alpha numeric beads that will work much like a necklace. This will illustrate that every character basically gets placed right next to the one before it. This illustrates that a string is literally a string of chars. To add strings, you take what is on one string and add it along side the next. Or you could have a third wire and place the contents of both onto the third. This would be a cool way to illustrate left, right, and mid functions on strings.

This should also illustrate the fact that in a strongly typed language, you can't add an integer to a string because they are completely different animals. You could show conversions back and forth by showing that the string "6" on a necklace would actually have to become six pennies in a round container or vice versa.

Arrays: Arrays will be represented by sections of an egg carton. So if I have an array of length 2, I would literally cut 2 connected sections off of an egg carton. If this was an array of integers, then each section would hold a container of pennies. If it is an array of strings, each section would hold a necklace.

Objects: I got a cheap fishing tackle box for this. This would be helpful for illustrating that a textbox on a form is not simply the text that you see. If you open that up, text is only one property of the textbox and maybe that would be a piece of white tape on the front with the textbox text written on front. If you open it up, you see a bunch of compartments on the inside that are labeled with properties like size, id, width, height, etc. In these labeled compartments you could use penny containers and necklaces to illustrate the data types of those properties.

I like the idea of illustrating the data types because for many students, data types are a major hang-up and are not able to confidently progress while these remain a mystery. Hopefully these physical representations will go a long way toward building a firm foundation or understanding. It really helps me to have a mental picture of what I'm doing, but if I have never seen anything physical that is like what I'm doing, it's just fog.

I'll keep you posted as to whether or not this works and what type of student it works for.

Comments !

links

social