Tuesday, December 10, 2013

That Is Not My Name

My first major in college was Sociology.NameTag I did finish it along with a second major in Systems Analysis (few CS majors existed back in the dark ages) and to some extent that sociology background influences how I look at Computer Science concepts. Take for example identifiers. Variable names, method names, class names, and many more items in a computer program have names. Using these names correctly is important.

There are parallels in human interaction. There are cultures where people have two names with one being public and the other being private. Why? Because these cultures believe that knowing someone’s secret or real name gives one power over the person. There is some truth to this in reality. Any teacher can tell you that yelling “hey you stop” at a running student is far less effective than yelling “Michael Robinson stop were you are!” (made up name) Knowing a student’s name gives you more power than not knowing it. Using the wrong name on the other hand is often worse than useless. Trying calling a child by their sibling’s name sometime and see what sort of response you get.

Names, or identifiers if you want to get all technical, are what give us power over the objects/data they represent. When we teach students to program one of the things that we always try to get across is that names should be descriptive. Names should mean something and not be random or arbitrary. They should tell us something about the object in use.  They should also help us use the right object at the right time. Seems easy but some beginners struggle with this.

I’m seeing some of these issues with my beginners. They spell names incorrectly or they use the wrong names in formulas. They sort of expect the computer to know what they are thinking. I repeat the common phrase “computers do what you tell them to do not what you want them to do.” but it sometimes takes a while to sink in. I’m working on finding ways to help them with it. Explaining it doesn’t work so I need some visuals. Any ideas?

1 comment:

Garth said...

Have kids turn in copies of intermediate stages of their programs. Grade these for legibility and comments, not if any thing works. If they are intermediate they probably will not work.