This week we will begin working through the GridWorld Case Study in the Java Methods book (pp.43-78). I have also created a packet (GridWorld AP Computer Science Case Study Student Manual) to use during this process.
To begin with, we'll need to download the source code (see previous post), unzip the file, and drag the GridWorldCode folder to the main Java folder. Then we'll add the GridWorld.jar file to the BlueJ library. Once that is complete we will be able to view and run the BugRunner program.
Read 3.1 Prologue: Consider how huge a computer program needs to be to do something like have a soldier run through a battlefield. Not only is the battlefield an object... and the soldier is an object... and the soldiers head is an object... and his eye is an object (if it has its' own properties)... but going deep enough, the pupil in the soldiers eye could be an object that dilates or contracts. As projects grow like this you will need to learn techniques to keep things organized.
Read 3.2 Case Study: GridWorld: The text describes the difference of class and objects again. And in the section where they describe the difference between the visual representation of objects and the coded objects themselves, you can think of programs like Minecraft where you can apply a different "skin" to an object. The program works exactly the same, but the skin is different. This is also the section where they have you read through Part 1 of the Student Manual (which I am providing you).
This section also discusses the important function of CRC cards for classes. In this example you can see two different classes (Predator and Habitat), the class "responsibilities" (generally what it does), and "collaborators" (other classes it depends on).
We will also be opening the BugRunner program and playing with the display.
No comments:
Post a Comment