CSSE 221: Fundamentals of Software Development Honors
JavaEyes

Work on this exercise by yourself, but be quick to ask questions of your instructor, student assistants and classmates as desired.

Goals

The goals of this exercise are to:

The Exercise - Overview

You will:

Instructions, Part 1 - Checkout the Project

  1. Open Eclipse.
  2. Add the SVN Repository Exploring perspective.
  3. You'll get an SVN Repositories view where your console lives. You should see your individual repository (if not, go back and do the HelloWorld assignment). Expand it and you should see a JavaEyes folder.
  4. Checkout your JavaEyes project.
  5. Get ready to read/modify the code.
    Consider: Checking out JavaEyes changed your Package Explorer view. (It may also have changed your Problems view, since JavaEyes intentionally has some errors.) How is your Package Explorer view different than it was before you checked out the JavaEyes project?

    Instructions, Part 2 - Fix the compile-time errors

  6. Examine the Problems tab. You should see two errors and four warnings.
  7. Fix the errors (but leave the warnings for now) by:

    Before continuing, make sure that you understand how to use Quick Fix. Ask questions as needed.

  8. Run the program (the green arrow is handy) and play around with some of its features.
  9. Instructions, Part 3 - Read the code

  10. Answer the following questions as you browse the code.
    Consider: How many classes are in the JavaEyes project?
    Consider: How many constructors does the Eye class have?
    Consider: How many other methods does the Eye class in JavaEyes have?
    Consider: How many fields does the Eye class have?
  11. Hover over a variable anywhere in the code. Note the help that pops up.
  12. Hover over a reference to a class anywhere in the code. Note the help that pops up.
  13. Hover over a reference to a method anywhere in the code. Note the help that pops up.
  14. Instructions, Part 4 - Code-completion and compile-on-the-fly

  15. Find the code that declares the eye (not eyeball) color. Change it to another (non-white) color of your choice.
  16. Eclipse compiles on-the-fly. This means it can find compile-time errors automatically for you and suggest fixes.
    Consider: In Eclipse, do you need a separate “build” or “compile” step before you run?
  17. Instructions, Part 5 - Fix a run-time error

  18. Run JavaEyes until you see a red run-time error message in the Console window.
  19. Decipher the red run-time error message in the Console window. Ask questions as needed.
    Consider: What Exception (error) occurred, according to the error message?
    Consider: At what statement did the Exception (error) occur, according to the error message?
  20. Fix the source of the run-time error (while keeping the rest of the program intact).
  21. Remember, in all your code:

    Here is the grading rubric for this assignment.

    Instructions, Part 6 - Fix documentation errors

  22. The Problems tab shows four warnings, all resulting from missing Javadoc comments. Use Quick Fix on each warning to add a Javadoc comment. Then fill in each Javadoc comment appropriately, using the Javadoc comments elsewhere in the code as examples.
  23. Note that the doc folder in Package Explorer is empty. Generate the html Javadoc now by:
  24. Note that the doc folder in Package Explorer now has lots of files. Click on some of them to examine the generated Javadoc. Pretty cool, yes?
  25. Try right-clicking on the html file for one of the JavaEyes' classes and select Open with ~ Web browser. In the browser that opens, browse the JavaEyes classes and some of the non-JavaEyes classes that are linked.
  26. Confirm that the external browser shows the comments that you typed. Confirm that those comments are accurate and appropriate -- if not, fix the comments and regenerate the Javadoc.
  27. Instructions, Part 7 - Add eyes (the has-a relationship)

  28. Check out the UML class diagram for JavaEyes.
    Consider: Suppose that you want to add a 3rd eye that behaves just like the other two eyes. What change(s) to the design are necessary? That is, what change(s) must you make to the UML class diagram to reflect the addition of a 3rd eye?
  29. Implement the design change(s) per the previous item -- that is, add a 3rd eye that is just like the other two eyes.
  30. Add a 4th eye that is just like the other two eyes, except that the 4th eye's color is green and the 4th eyes' eyeball has color orange.
  31. This part of JavaEyes showed you that you can implement different kinds of Eyes by using fields -- in this case, fields for the Eye's color and the color of the Eye's Eyeball. You construct different kinds of Eyes by using the two-parameter constructor that lets you specify these colors when the Eye is constructed.

    Consider: Suppose that you want to implement square Eyes (i.e., Eyes that are drawn as squares instead of as ovals). How could you do this? (Just this about this; you do not need to implement this, although it is not hard to do so.)

    Instructions, Part 9 - Many eyes (using a loop)

  32. Using a loop, add 99 Eyes (all of which behave the same way). Far out!
  33. Finally, examine the Tasks tab at the bottom of Eclipse and complete any TODO items for this project.
  34. Instructions, Part 10 - Turn in your work (i.e., commit your project)

  35. Commit your JavaEyes project to the repository from which you checked it out, by: