We had a particularly fun CS21A session today. I wanted them to learn how to grow an array and how to guarantee uniqueness. Instead of giving them a well-prepared step-by-step lab, I wanted to help them practice understanding oral instructions and gathering requirements. The exercise was this:
I’m a teacher. I want a program that helps me keep track of attendance. I also want to be able to pick random students for recitation. I’ll add the nicknames of the students as they enter. During the class, I’ll ask the computer for random names to call. At the end of the class, I want a sorted list of nicknames so that I can enter the names into my record. Deletion was optional.
I had them go through the problem-solving process
Some guide questions were:
– What is the problem?
– What do I already know how to do?
– What do I need to learn in order to solve the problem?
– How do I go about learning what I need to learn?
– How do I solve the problem?
– How do I check if the problem is solved?
It was very fun to see them break into lively discussion, although I’m still a little worried about some students who don’t really join the others during the discussion. I should find a way to draw them into it.
The exercise was a good way to introduce the problem of resizing arrays and it will help them better appreciate Vectors. We’ll discuss those on Monday, but I’ve assigned the slides and the book as reading.