Abstract

ion which demonstrate that an abstract approach to thinking and designing is vital. In this section, we will describe several abstractions we introduce at Northeastern and explain what principles each helps to elucidate. Loops, Decisions, and the Swimming Fish Lab The Swimming Fish laboratory exercise is designed to require students to program a loop with decisions in which the progress of the loop cannot be predicted prior to runtime. The situation of the exercise is a large underwater maze-like cave in which a large fish searches for food consisting of a school of small fish { see Figure 2 }. Figure 2: Typical Initial State of the Swimming Fish Laboratory The large fish is initially positioned at the left side of the cave and the school of small fish at the right. The cave is randomly generated but is designed so that the large fish can find the food using only moves up or down or to the right. The large fish never needs to backtrack to the left. The Swimming Fish laboratory is introduced to the students about seven weeks into the first course before array data structures have been discussed. The students are able to solve the exercise because the critical tools are presented as abstractions. The solution is based on a shell program which the students must complete, on four of the basic tools modules, and on a file which contains the picture resources for the large fish and the school of fish. The four key abstractions which the students use to program the search of the large fish for the food are: type directions = (up, down, right); function freetomove (d: directions):

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call