Variables Late or Variables Early?

Computer Science Teacher
Computer Science Teacher - Thoughts and Information from Alfred Thompson

Variables Late or Variables Early?

  • Comments 3

One of the shining stars of teaching computer science in recent years is the Alice environment. There is some early research and many anecdotal tales of great success using this tool for teaching beginning programming. I must admit that I like it myself. It is friendly and powerful. I especially like the story telling possibilities as I can see them attracting a lot of people into doing interesting things with programming.

At this year's SIGCSE there was a cautionary note sounded in one paper though and I think it is worth thinking about and discussing. The paper is called Through the Looking Glass: Teaching CS0 with Alice. Now the paper is far from all negative but it does raise a number of interesting points worth considering by teachers planning on using Alice.

One of the concerns is that Alice allows teaching variables late in the learning process. This is different from the normal way of doing things. In the past variables were generally introduced at the very beginning of a programming course. Typically one creates an expression using a number of variables and displays the results of the expression. This is about the first thing done. With Alice though very interesting and powerful things can be done without using any variables at all.

In fact using variables is somewhat complicated. Not complicated in an absolute sense but complicated compared to other things in Alice. Without a book I confess that I struggled a bit figuring out the combination of creating, initializing and using variables in expressions. Once I had it down teaching it to others was easy but still not so intuitive as other features. But what does that mean?

According to the paper some of the students who learned Alice first had some trouble with the concepts and use of variables - if not in Alice than in what ever language (usually Java in this case) they learned next. I suspect that this problem exists in other similar tools to some degree.

When I learned Scratch in a workshop they did cover variables early on. I grasped them easily though if that is do to a) good teaching b) a better interface for variables or c) having already learned my way around because of Alice  I am not at all sure. My hope is actually that it was because of good teaching because good teaching is less painful as a plan for reproducing success. But still some of the concerns expressed about Alice also seem to apply to Scratch.

I think that variables are a very important base concept in computer science in general and programming in particular. I think that teaching variables early is the way to go. I think that Scratch has a small advantage over Alice here BTW. The domain of possible applications is broader with Scratch than with Alice and that lends itself to more interesting variable related projects earlier in the cycle. At least that is my current theory. I'd love to discuss that with others who have tried both tools.

One last word, I do worry most about the jump from simple, easy to use and learn programming environments to the next level (programming with standard programming languages) of programming. That was an issue back in the day with Logo and it remains an issue with tools like Scratch and Alice. They are great at what they do but how do we make the move to languages like Java, C#, C, C++ or Visual Basic smoother and easier for beginners? Now there is a question!

My site was nominated for Best Education Blog! Please vote!

  • "I do worry most about the jump...to the next level...of programming."

    Is the issue really the same as with Logo? I have a hard time imagining that it is, but can't speak from first-hand experience. My feeling comes from the fact that Logo made you write code, even for controlling the turtle; you weren't building with graphical blocks and setting properties on them; and Logo was targeted at very young children, without trying to transition them to Java or C++.

    Common sense tells me that these two (Alice and Java/C++) are SO different that I question the use of tools like Alice as an introduction to "programming". Even today, there is no reason you couldn't use Logo, starting with a focus on turtle graphics, but transitioning into Brian Harvey's work, maintaining language continuity. Would Logo be much worse than teaching Scheme in that regard? Different, yes, but more alike than different when compared to the Alice/C++ scenario.

  • Interesting questions about Logo. I think that Logo would be a big jump in some areas and not so bad in others. As you point out there is code in Logo. But variables are pretty optional. Also you can't easily do anything with objects in Logo. At least not in the versions I have used.

    Scheme is another interesting case. THere are some who insist that the transition from Scheme to other languages is natural and easy but I am not so sure.

    Other things that are sort of like Logo are Karel J Robot but I'm not sure it is really that much easier than starting with Java. It's not an easy question.

  • "But variables are pretty optional."

    Only in the sense that they are optional in any functional language. :)

    "Also you can't easily do anything with objects in Logo."

    Unless you use ObjectLogo, or revise the definition of what "object" means. Consider that the turtle is an implicit singleton in standard Logo; or look at NetLogo, and consider whether agents are objects?

    I don't think Scheme is particularly easy, but what makes Logo so great, IMO, is that it *is* easy, and yet it's also a functional Lisp dialect that you can to study advanced concepts. The functional versus OO debate is a whole 'nother ball of wax though.

Page 1 of 1 (3 items)