CSSE 220 – Object-Oriented Software Development

Homework 12

Objectives

Practice with designing and implementing classes. Learn the Violet tool for drawing UML class diagrams.

Tasks

  1. Complete the assigned reading for the next session: §9.1–9.5. (See schedule for topics to focus on.) As you read, see if you can answer the self-check questions. If there is something you do not understand, make note of it so you can ask about it.
  2. Complete the assessment exercise over this reading on ANGEL (under Lessons → Assignments).
  3. Install Violet: Download and install the Violet program for drawing UML diagrams by following these instructions.
  4. Written exercises: You should write your answers to these questions neatly on paper, or type and print your answers if you prefer. Your UML class diagrams should be done using Violet.

    1. Suppose you were going to implement a program to let two people play chess against each other. Think about what classes you would need. (Search on-line to find the rules of chess if you aren’t familiar with the game.) List all the classes that you can think of that might be useful in implementing your program. For now you can assume that users will enter moves in the console, but you’ll display the board in a graphics window.
    2. From your list of potential classes, decide which ones you would use in an actual implementation. Pay particular attention to the rules for good classes that we discussed in class. Using Violet, draw a UML class diagram for your classes. Show the public interface (i.e., methods) of each class and the dependency relationships between the classes. Recall that dependency relationships are indicated by dashed lines with open arrow heads.
    3. Write a couple of paragraphs explaining why you chose the classes that you did for your design. Discuss the cohesion and coupling of your classes.
  5. Programming:
    1. Your programming work for this part must be done in the DesigningClasses project inside Eclipse. Use the SVN Repository Exploring perspective to check out this project, then switch back to the Java perspective.
    2. Create classes based on your design for Chess. Create constructor and method stubs for your design and add javadocs. You do not have to actually implement the constructors and methods at this time, though you may do so if you find that interesting.

Turn-in Instructions

Turn in your programming work by committing it to your SVN repository. Bring a paper copy of your written answers and UML class diagram to class.