CS680
Fall 2008
hw3 - Pong model/GUI, model API, unit tests

Due Thurs, Oct 9, by midnight

In this assignment you will--

  1. In this assignment you'll work on the supplied partial Pong project (zip) that we refactored in class as a solution to hw1. All classes are currently in package game. First, refactor Pong.java into PongGUI.java and PongGame.java, so that PongGame.java is a proper model, layered under PongGUI. Note that "bip" is GUI. Use the Observer pattern to handle the GUI parts of the tick handler, which itself belongs to the model. Put all GUI sources in package game.presentation, and all model sources in package game.model. Make sure "ant run" still works.
  2. In memo.txt, write down and defend your model API. Is it minimalistic? Is it easily understood by the artistic people doing presentation? Also explain why we don't need the Observer pattern for the UI action of moving the paddle.
  3. Convert BallTest.java to JUnit 4. Note that build.xml already has a test1 target so that "ant test1" runs BallTest as a JUnit test.
  4. Write a unit test for PongGame, PongGameTest, in JUnit4. Add a target  "test2" to build.xml to run PongGameTest, and a target "tests" to run both tests.
  5. In memo.txt, describe what your unit test tests, and any untested functionality.
  6. Implement the computer paddle activity. It can just move the paddle instantaneously to the right place for now. 
  7. In memo.txt, explain any changes to the model API you needed for this enhancement. Report on any delays you can observe due to the computer having to extrapolate the ball's flight after you hit the ball back. Explain how you could avoid such delays by using another thread, and if you have time, implement this better way and report on the new performance.
  8. Consider the tic-tac-toe game. Play it at http://boulter.com/ttt/. This is a typical web "pull" UI. In memo.txt, explain what "pull UI" or "pull MVC" means and why this UI should be called that. Construct a model API for this game and write it down in memo.txt.  Read the discussion at theserverside.com/patterns starting from Message #125535.
  9. Read pg. 239 of B&D and classify the MVC described there as pull or push. Similarly classify the MVC described in F&F on pg. 536. Note that push MVC is sometimes called "real MVC". So "pull MVC" isn't "real MVC", but rather MVC working under requirement of doing pull UI.
  10. (optional) Coming: how can we support both Pong and TicTacToe in our games project? If you have time and ideas, write them down in memo.txt

Deliverables

We will collect your work electronically from a hw3 subdirectory of the cs680 directory the Department's UNIX system created for you when it approved your account for this course. Do not modify the permissions for that directory.

You may work on any machine with any operating system and development environment you choose, but the programs you deliver must compile and run on the Department's UNIX system. The supplied build.xml allows Swing programs to run on our UNIX systems even from a remote login, by using my office screen.

Your memo should be pure ascii text, with no markup (no html, no MS Word). When printed on the Department printers no text should be lost at the ends of lines. If you want to submit some hard copy of diagrams, you may bring them to class the day the assignment is due.

We will look in your cs680/hw3 directory. It should contain (case matters in filenames on UNIX!)