COMP 310
Fall 2017

HW03: Composition-based Ballworld

Home  Info  Canvas   Java Resources  Eclipse Resources  Piazza

Assignment Instructions

Replicate the composition-based Ballworld demo.

Recommended Development Process:

  1. If you haven't done so already, branch your HW02 codebase to a new trunk at the top level of your repository called "HW03".
  2. Finish the work started in lab to convert your codebase to a proper MVC architecture.   Make sure your system works completely at this stage!  
  3. Modify your ABall class to be concrete (change its name!) and take an IUpdateStrategy in its constructor.
  4. Implement a StraightStrategy.
  5. Test your code by temporarily commenting out your load ball code and hard-coding it to load a ball with a StraightStrategy.   You should have bouncing straight balls.
  6. Modify your dynamic class loading code so that it will instantiate and return a strategy.
  7. Modify your load ball code to instantiate and load a ball with a given strategy object.
  8. Implement at least one other strategy, a simple one.
  9. Test that you can type in a strategy name and it will create a ball with that strategy.
  10. Modify your GUI so that it has the drop lists and additional buttons.
  11. Add the supplied IStrategyFac utility methods to your model.
  12. Implement the "Add to Lists" and "Make Ball" buttons by adding their event listeners and connecting them to appropriate (perhaps new) methods on your adapters.    Implement those adapter methods by calling the supplied utility methods on the model.
  13. Test that you can add and create balls with your existing strategies.
  14. Implement the MultiStrategy.
  15. Implement the "Combine!" button functionality.
  16. Test that you can arbitrarily combine strategies in your balls.
  17. Implement the Switcher ball buttons and their behaviors on the model.   How many SwitcherStrategy instances are ever in existence?
  18. Enjoy!

YOUR HW03 SVN REPOSITORY MUST BE AT THE ROOT OF YOUR SVN FOLDERS AND BE CALLED "HW03"!

Composition-based Ballworld considerations:

GUI:

Model:

 

For those people who have way too much time on their hands and want to try something really nuts, try making this.  Warning:  This application is quite challenging, though it does technically only use techniques you've already seen.   Talk to the instructor for guidance if you want to tackle this project.

 

Grading Criteria

  1. Replicating the demo's behavior
    1. Can type in either full or abbreviated strategy class name into text field (not required to support both full and abbreviated class names).   - 5
    2. "Add" button adds strategy to both lists - 5
    3. "Make" button will create ball with selected strategy.  - 5
    4. "Combine" button will add a strategy (factory, actually) to the lists that is the combination of two selected strategies.  - 10
    5. "Make Switcher" makes a ball with a Switcher strategy (initial strategy unspecified here).   - 5
    6. "Switch" button will change all current Switcher balls to the selected behavior  -5
    7. At least 5 different types of strategies can be made and combined.''    - 10
    8. Discretionary pts - 5
  2. Architecture
    1. UML diagrams.  - 5
    2. Ball class is fully concrete.   Only 1 ball class.    - 10
    3. All variant updating delegated to a strategy   - 10
    4. Strategy factories sent to/from the GUI.  - 5
    5. Combination of two strategies created through the use of a generic strategy that holds and executes two arbitrary strategies.   - 10
    6. Swtcher strategy is implemented as a wrapper over a single arbitrary strategy with a "setStrategy" accessor-type method to change the strategy.  -5
    7. Discretionary pts - 5

 


© 2017 by Stephen Wong