1 / 28

Marine Biology Simulation Case Study

Marine Biology Simulation Case Study. Alyce Brady Kalamazoo College. Case Study as Educational Tool. describes a real situation provides an interesting example from which to draw certain lessons provides a context for comparing theoretical ideas against real-world experience.

eljah
Download Presentation

Marine Biology Simulation Case Study

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Marine Biology SimulationCase Study Alyce Brady Kalamazoo College

  2. Case Study as Educational Tool • describes a real situation • provides an interesting example from which to draw certain lessons • provides a context for comparing theoretical ideas against real-world experience

  3. Case Studies in AP CS • try to give the illusion of being a real-world situation (MBCS) or real-world tool (BigInt) • must be simplified and cleaned-up enough to be readable and understandable for HS students

  4. Benefits of an AP CS case study • example of a largish program • opportunity to discuss tradeoffs (design, performance issues, readability, etc) • example of good coding, design, and documentation practice • approximation of master/apprentice • rich source of assignments • source of non-trivial exam questions

  5. Alyce’s Additions • describe the development or modification of a program, not just a finished product • cover design • cover testing

  6. Goals for Java MBS • provide benefits described in prev. slides • be similar to C++ MBCS • teachers can pick it up faster • can use it as they learn Java • be different from C++ MBCS • highlight differences in language • highlight differences in curriculum

  7. The Story • A CS student, Pat, gets a summer job working for marine biologists. • Hired to enhance an existing program that simulates fish movement in a bounded environment. • Needs to understand existing program • Designs, codes, and tests modifications • Occasionally Pat turns to an experienced programmer, Jamie, for help. • Narrative is Pat’s report of summer job.

  8. The Package • Code for the “existing” program • Source for core classes • Jar files for “black box” & GUI classes • Javadoc documentation for most classes • Data Files • Instructions for compiling/running • Narrative (pdf file)

  9. The Modules (Chapters) • Experiment with existing program • Guided tour of existing program by Jamie • Add breeding and dying • Add two new kinds of fish (inheritance) • Provide alternative representations (unbounded environment, others)

  10. Chapter 1 First Day on the Job • “[The program] was designed to help the marine biologists study fish movement in a bounded environment, such as a lake or a bay.” • Jamie available the next day. • Given instructions for running it and told where to find data files.

  11. Chapter 2 Guided Tour • “The biologists think of the environment as a rectangular grid, with fish moving from cell to cell in the grid. Each cell contains zero or one fish.”

  12. Chapter 2 What classes are necessary? • To model fish swimming in a bounded environment, the program has Fish objects and an Environment object. • The purpose of the program is to simulate fish moving in the environment, so the program also has a Simulation object. • There are other useful, but less important "utility classes."

  13. Chapter 2 One step in the simulation

  14. Chapter 2 What do core classes look like? • Simulation: almost identical to C++ MBCS • Environment: black box; only look at class documentation (think header file!) • Fish: • has color, direction • move method is a little more complicated, has more helper methods

  15. Chapter 2 move method • Get next location to move to (call nextLocation) • If next location is different from this location, • move there (call changeLocation) • change direction (call changeDirection)

  16. Chapter 2 nextLocation method • Get list of empty neighboring locations (call emptyNeighbors) • Remove location behind fish from list • If there are any empty neighbors left, randomly choose one; otherwise return current location

  17. Chapter 3 Breeding and Dying • Problem Specification: A fish should ... • have a 1 in 7 chance of breeding, • breed into all empty neighboring locations, • attempt to move when it does not breed, • never move backwards, and • have a 1 in 5 chance of dying after it has bred or moved.

  18. Chapter 3 Breeding and Dying Pseudo-code for act method if this is the 1 in 7 chance of breeding call the breed method else call the move method if this is the 1 in 5 chance of dying call the die method

  19. Chapter 3 Breeding and Dying • Test Plan • Testing random behavior (Chap 2) • Black-box testing • Code-based testing

  20. Chapter 4 Specialized Fish • Different patterns of movement • Darters (DarterFish) • Slow fish (SlowFish) • Inheritance • Dynamic Binding

  21. Chapter 4 Specialized Fish • DarterFish • darts two cells forward if possible • or darts one cell forward • or reverses direction (without moving)

  22. Chapter 4 Specialized Fish • SlowFish • has only a 1 in 5 chance of moving out of current cell • otherwise movement is the same as Fish

  23. Classes for A Exam • Class Implementations • Simulation • Fish (as modified in Chapter 3) • DarterFish • SlowFish • Class Documentation • A number of utility classes

  24. Chapter 5 Environment Implementations • Multiple environment implementations • Environment Interface • Bounded: 2D array (matrix) -- existing • Unbounded: ArrayList of Fish -- Pat develops this implementation

  25. Chapter 5 Environment Implementations • Exercises • Very large bounded environment (list or sparse matrix) • Sorted list for unbounded environment with binary search • BST for unbounded environment • Hash map for unbounded environment

  26. Classes for AB Exam • Classes and documentation from A Exam • Additional Class Interfaces/Implementations • Environment • BoundedEnv • UnboundedEnv • Class Documentation • One new utility class

  27. Key Features • Overall design & core classes are similar • Discussion of modification/development allows focus on design and testing • Highlights new/different language features • Highlights new topics in curriculum • Inheritance, dynamic binding • Interfaces

  28. Want to use it? • www.collegeboard.com/ap/students/ compsci/download.html

More Related