Exercise 3 (Refactoring of Exercise 2)
Completion requirements
Opened: Thursday, 16 April 2015, 5:00 PM
Due: Thursday, 23 April 2015, 2:30 PM
Refactoring Ecosystem:
This exercise is based on exercise 2. The requirements for the ecosystem simulation are the same.- Improve (refactor) the Ecosystem simulation such that:
- The river does not contain any specific knowledge of a species.
- There are no if statements inside of the class River which determine a certain species.
- Adding another species (with similar behavior) must not concern any of the existing interfaces and classes. (Excluding your test cases.)
- After improving your program you should be able to add other species to the river without changing the class River.
I.e., you should be able to write new classes of type Animal, like Frog, Zombie,..., and use them inside your ecosystem:eSys.add(new Zombie());
eSys.add(new Frog());
- Add another species after improving your program:
- Implement another species of your choice (e.g. Zombies) without changing any other class or interface. (Excluding your test cases.)
- Test the ecosystem including your new species.
- Provide a (change log) document which contains the changes you made.
- Update the model, such that it describes the new version.