Aside: Data structure maintenance
Fixing the Bat snatch
method gives a nice example of a change of
emphasis in our programming. Early in the course the emphasis was on
figuring out algorithms, e.g. simulating the game of craps, where the
challenge was dealing with the intricacy of the algorithm. Now there is
a new challenge: maintaining the integrity of intricate data structures.
The key to doing this successfully is to be aware of the meaning of the
connections between objects and of the implications of object
actions on those connections.
I find all but the simplest data structures difficult to visualize just by looking at the code that creates them so I draw diagrams like the ones in this module to help me see what manipulations need to be done. You may want to too.