Download presentation
Presentation is loading. Please wait.
Published byLanny Oesman Modified over 6 years ago
1
Marine Biology Simulation Part III: Assignment, Milestone 2
Dung “Zung” Nguyen Mathias Ricken Stephen Wong TeachJava 2004! June 25, 2004
2
Rice MBS Assignment Milestone 1 Milestone 2 Part 1: KnightFish
Add a new fish species to the simulation Part 2: WrappingEnv Add a new kind of environment Milestone 2 Part 3: Internals Re-implement parts of the simulation framework Part 4: Behavior Strategies Refactor framework to allow dynamic behavior changes
3
Preparation Download materials for Milestone 2 Open DrJava
milestone2.zip Unzip into empty directory Open DrJava Copy your drjava.jar into the project directory Remove RiceMBSfw.jar from “Extra Classpath”
4
Part 3: Internals Open the DrJava_Test_* files tests package
Hit the test button Several tests will fail Critical portions of the framework have been removed Tests provide students with feedback Guide the way without giving away the answer Better error messages than just “NullPointerException” and the like
5
Part 3: Internals Code missing in several places of the framework
Fish Local environment Global environment Gives students a tour of the entire framework
6
Re-implement as per given specs.
Part 3: Internals Re-implement as per given specs. Pedagogy: Modular design enables students to work on smaller pieces Give jar files of framework to start Students guided by unit test requirements Exercises: new fish, new environments add features (e.g. breeding, eating, etc) Re-implementation of initially supplied compiled classes. Unit tests guide the way
7
Part 3: Internals Students gain insight into
Abstraction and loose coupling Message passing Writing large frameworks Working with someone else’s code Requires extensive work within existing framework At the end of this part, students have completely restored the original functionality
8
Part 4: Behavior Strategies
Once students have understood the existing framework, they can improve it Point out one of the flaws Fish cannot change behavior This part involves refactoring the old code and creating a new class hierarchy
9
Part 4: Behavior Strategies
Separate the variants from the invariants + void move() Strategy Pattern
10
Part 4: Behavior Strategies
Students have the opportunity to Apply design patterns to improve the project Refactor a substantial portion of the code Experience how loose coupling makes this easy Use unit tests to protect against previous bugs Maintain documentation Requires new design and code that augments existing framework At the end of the assignment, students will have added a major feature to the simulation
11
Summary Students slowly gain experience with the framework
Parts 1 and 2 provides a lot of support Part 3 gives students more responsibility, but unit tests provide guidance Part 4 gives students freedom to design and improve Compelling and entertaining example of object-oriented design
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.