One of the classing problems in teaching a first course in computer programming is what order to teach various concepts. So many things are interdependent on each other that sometimes you wish you should teach everything at once. That would generally cause student heads to explode so its not a great option. One area I struggle with is loops and arrays. They are both so much more interesting to me with the other. So I asked people on Facebook about this.
Most said they taught loops first and then arrays. This makes some good sense. (Even if it is how I do it.) Arrays are more useful and interesting when paired with loops after all. They are almost pointless without loops. Almost being a relative term of course. Also loops follow on directly from decision structures. Once you talk about Boolean expressions for if statements adding the idea of using them in a loop is pretty natural. Once can come up with some fun loop demos even without arrays.
And then others added opinions. Some did suggest arrays first. Once you have an array you pretty much need loops. This tends to feel like some “just in time learning” in that now you have a need so “let’s talk about a solution.
A couple of people talk about arrays as part of a larger conversation about variables. This also makes sense. Arrays are after all variables. It’s a simple step from “Student0, Student1, …” to Student[i]. This is similar to the logic behind following decision statements with loop statements in that you are taking a concept one step further.
A case can be made for any of these options. I don’t know if there is research on which order gets the best results though. Anyone out there know of research? Most people just do what feels right for them. Or teach the same way their learned.
What really bothers me, and for what I have no clear solution, is that it feels like we talk about variables four times. Once for “normal” variables for standard data types. Later for arrays. Still later for strings. By that I mean at some point we talk about how strings are fairly special and have attributes of single item data types and also attributes similar to arrays. Lastly we talk about user defined variables and data types. Is it too much to talk about all of that at once? Probably. I can almost see the eyes glazing over.
All of this is why I think the first programming course is harder to teach than a lot of people think it is. Once you are through it a lot of things come easier. Of course once you’ve learned all the key concepts in a first programming course it all seems easy and obvious to you. Well if you learned them well they do. It is sometimes hard to remember how hard some of these concepts were the first time one heard them. It’s a new way of thinking for most people. And let’s not forget the syntax struggles!
Still I find teaching the first course rewording. I love seeing a student when something “clicks” for the first time and they see the potential. If only I could teach all the concepts at the same time.