1 / 23

Marine Biology Simulation Part I: Introduction

Marine Biology Simulation Part I: Introduction. Dung “Zung” Nguyen Mathias Ricken Stephen Wong. TeachJava 2004! June 25, 2004. The Role of Programming. Important skill Should be taught early in a student’s career Usually taught imperative-first

shania
Télécharger la présentation

Marine Biology Simulation Part I: Introduction

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 SimulationPart I: Introduction Dung “Zung” Nguyen Mathias Ricken Stephen Wong TeachJava 2004! June 25, 2004

  2. The Role of Programming • Important skill • Should be taught early in a student’s career • Usually taught imperative-first • Concentrates on language elements like expressions, operators, functions, pointers…

  3. Problems Teaching Imperative-First • Focus on syntactical elements • Exercises too simple to be motivating • Too little emphasis on design • Biased against students without prior knowledge

  4. Object-Orientation • Beneficial to software quality • Correct, robust, flexible, and extensible • Extensively covers software design • Examples are more challenging and motivating • Usually considered “advanced concept”

  5. Assignments • Assignments have to be complex • Highlight benefits of object-orientation • Large design portion • Find proper abstractions, variants / invariants • Solve family of problems • Challenge to find suitable assignments • Example: Marine Biology Simulation

  6. AP Marine Biology Simulation • Case studies in AP curriculum since 1994 • Argument: “Some good reasons to use a case study in AP Computer Science include: • Working with a program of significant length • Thinking through issues of good program design • Learning from an expert programmer” (AP Marine Biology Simulation Case Study – Teacher’s Manual)

  7. AP Marine Biology Simulation • Goal: “Through the AP Marine Biology Simulation Case Study, the strategies, vocabulary, and techniques of object-oriented design will be emphasized.” (AP Marine Biology Simulation Case Study – Teacher’s Manual) • Shortcomings • Improper abstractions, incorrect delineation of responsibilities • Tight coupling  not robust  not flexible and extensible

  8. AP Marine Biology Simulation Demo

  9. Unenforceable contracts Replicated data Insecure architecture Limited extensibility AP Marine Biology Simulation a few pitfalls... Key issue: Tight Coupling

  10. Which is not the same as here. On some global coordinate grid? And not the same as here either. I know where I am: right here. Think Simple. Where am I? Do I know my own coordinates? Does anyone else know my coordinates? Should I know anyone else’s coordinates? Do I really care where Greenwhich is? To change my location is to change my LOCAL environment. Knowing my location does NOT mean I know my global coordinate! ? X X X Latitude = 29.65 Longitude = 95.28

  11. X X X X X Each fish has its own local environment The local environment is an indirection layer between the fish and the global environment. The local environment decouples the fish from the global environment.

  12. Fish and their Environment The local environment provides services to the fish A fish has a local environment Local environment communicates with global environment but fish do not. The local environment is instantiated by the global environment The local environment does NOT provide x-y coordinates! Factory Method Design Pattern Decoupled, robust & secure behavior!

  13. Send commands to local environment The fish responds accordingly! Unblocked case command A Fish’s Dilemma The appropriate command is selected Can I move forward? Blocked case command Send a message to the local environment! ? Unblocked! Blocked! X

  14. MoveCommand Local environment makes a move command Or… The appropriate command is selected Move command sent to fish If desired, fish applies move command ? A fish can ONLY move as prescribed by its environment! X Unblocked! Blocked!

  15. A fish does not need to know its x-y coordinate! A fish does not need to know “how” to move! Decoupled, yet interactive behavior! A fish is decoupled from the global environment!

  16. Fish-Environment Interaction Delegate to the local environment SimpleFish Class _localEnv.tryMoveFwd(this, , ); new ILambda() { public Object apply(Object notUsed) { turnRight(Math.PI); return null; } } Command to execute if blocked new ILambda() { public Object apply(Object moveCmd) { ((ILambda)moveCmd).apply(null); return null; } } Command to execute if unblocked

  17. Depending on whether the new local environment is empty or not… Fish-Environment Interaction Make local environment in the direction the fish wants to move LocalEnvironment Class Code is used in a class assignment and has been removed … either make a command that actually moves the fish… … and execute the unblocked command … or execute the blocked command No if-statements!

  18. Design Benefits Decoupled, abstract design Enhanced capabilities • Replaceable environments • Different fish • Robustness

  19. Rice Marine Biology Simulation Demo

  20. The Culmination of a Unified OO Pedagogy ~ end of 2nd semester. MBS Unit Tests Design Patterns Polymorphism Abstract Structure and Behavior

  21. Problems Using This in AP Classes • Defined curriculum • Students must perform well in exams • Teach what exams require • Current curriculum disagrees with our approach • Rice MBS is for university-level classes

  22. Results • Addresses problems of imperative-first • Focus on design • Motivating assignments Objects-first is programming for everyone • Not biased against • Lack of experience • Gender • Declared Major • Year in School • SAT Scores AP curriculum will hopefully change

  23. Future Work • Make simulation guarantee progress • Prevent one fish from blocking others • Extra credit competition using MBS • Game of life, outbreed other species? • Study MBS along several cognitive dimensions • Improve assignment quality

More Related