Presentation is loading. Please wait.

Presentation is loading. Please wait.

Marine Biology Simulation Part I: Introduction Dung “Zung” Nguyen Mathias Ricken Stephen Wong TeachJava 2004! June 25, 2004.

Similar presentations


Presentation on theme: "Marine Biology Simulation Part I: Introduction Dung “Zung” Nguyen Mathias Ricken Stephen Wong TeachJava 2004! June 25, 2004."— Presentation transcript:

1 Marine Biology Simulation Part 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 lengthWorking with a program of significant length Thinking through issues of good program designThinking through issues of good program design Learning from an expert programmer”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 Insecure architecture a few pitfalls... Key issue: Limited extensibility Replicated data Tight Coupling

10 Where am I? Latitude = 29.65 Longitude = 95.28 On some global coordinate grid? 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? Think Simple. I know where I am: right here. X X Which is not the same as here. X And not the same as here either.

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

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

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

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

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

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

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

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

19 Rice Marine Biology Simulation Demo

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

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 Not biased against Lack of experience Gender Declared Major Year in School SAT Scores Objects-first is programming for everyone 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


Download ppt "Marine Biology Simulation Part I: Introduction Dung “Zung” Nguyen Mathias Ricken Stephen Wong TeachJava 2004! June 25, 2004."

Similar presentations


Ads by Google