COMP 310
Spring 2018

HW04: Fishworld

Home  Info  Canvas   Java Resources  Eclipse Resources  Piazza

Deprecated Web Page! This content has either been moved to Canvas or has been removed from the course. Please inform the staff right away about any links that led to this page.

Assignment Instructions and Point Values

The assignment is to replicate the command-dispatching Fishworld demo.   You must complete the following features:

  1. The architecture must satisfy HW03 requirements, e.g. must be a Model-View-Controller design with apprpriately created interfaces and adapters and appropriate methods on each interface/adapter.   (10 pts)
  2. Painting should be performed as a strategy that the user can select.  (70 pts total)
  3. Implement command-based updating
  4. Full Documentation

 

Development Process

In this assignment, it is important to be very clear about exactly what you are doing and the role of each method you write.   On the last assignment, many of the errors and confusions stemmed for not carefully reading the lecture, lab and resource materials and following the directions that were outlined there.   An important skill that Comp310 emphasizes is to be able to assemble information spread across multiple sources and locations into a coherent solution to a problem.   Do not expect that the solution to this assignment can be found in a single lecture page.   Look in the lectures, look in the labs, look in the resource pages, look at your class lecture notes, look at the demos and their documentation, even....look at this page.

A very common mistake to make in this assignment is to attempt to program the entire painting process.  Everything that happens in an object-oriented program is the combination of invariant and variant pieces.  Remember that the superclasses provide the invariant pieces and the subclasses provide the variant pieces.   In an inheritance hierarchy, as one moves down the inheritance tree, each subsequent class adds more and more invariant behavior that its subclasses can use.  By the time you are at the bottom of the inheritance tree, the class is just adding some small piece to a much larger process, a piece that may in fact be in the middle of that larger process, so it looks like it isn't accomplishing anything.   Most of the code you will need is already printed on the web pages.   Most subclasses add very little code, perhaps even just supplying parameters to a superclass constructor.   

When writing your own custom paint strategy, first consider where in the paint strategy hierarchy it should be located.   In general, put it as low on the hierarchy as possible to take advantage of invariant behavior defined by its superclasses.   This minimizes the amount of code in your class to just its variant part.  In fact, your specific code may reduce to just a very few lines.

So, here are some things to remember:

 

 


© 2018 by Stephen Wong