Com S 362 --- Object-Oriented Analysis and Design EXERCISE 12: DOMAIN MODELS (1) (File $Date: 2003/10/20 03:16:17 $) The purpose of this exercise is for you to try a domain model. As with all exercises, this is to be done individually, not in teams. And it is due the day this topic is planned to be discussed in class, unless specified otherwise (see the syllabus at: http://www.cs.iastate.edu/~cs362/syllabus.shtml). As with all exercises, you have two choices for doing the work. You can either: - complete it as specified or - write down questions or problems that you had in trying to complete it. If you write down questions or problems you have, these should be detailed enough so that we can tell that you have read the materials and thought about them. (Don't just write: "I couldn't get it to work; say what you tried and what you didn't understand.) During the class where this exercise is discussed, you should try to get help with these by explaining what you did and what your problems or confusions are. Don't be shy; there will be other people with the same problem, and everyone can learn by discussing these issues. 1. [Domain model: layout crossword puzzle] Read chapters 10 and 11 of Craig Larman's book Applying UML and Patterns (second edition, Prentice Hall PTR, Upper Saddle River, NJ, 2002). Also, for more examples look at the web page for the StickSync project: http://www.cs.iastate.edu/~cs362/sticksync/ssd.shtml Make a domain model with associations (but no attributes) for the following use case. (That is, we are supplying you with a use case, and you are to extract a domain model from it.) Use Case : Layout Crossword Puzzle Primary Actor: Author Stakeholders and Interests: - Author: wants non-tedious way to create crossword puzzles, automatic numbering, and spell checking. Success Guarantee (Postconditions): A puzzle with clues is saved. Main Success Scenario (or Basic Flow): 1. Author asks the system to create a crossword puzzle with a given number of rows and columns. 2. System creates an empty puzzle with the given number or rows and columns. 3. Author enters a word for a particular direction (across or down) and starting square. 4. System places a black square at the end of the word (the next horizontal square in the same row if the word goes across, or the next vertical square in the same column if the word goes down) if the word does not end at the puzzle boundary. 5. Author enters the clue for that word. 6. The system remembers the given clue. Author repeats steps 3-6 until indicates done. 7. System places a black square in any remaining squares without letters. 8. Author asks to save the completed puzzle. 9. System saves the completed puzzle. Extensions (or Alternative Flows): *a. If, at any time, the Author wants to save the current puzzle: 1. Author asks to save the current puzzle. 2. System saves the puzzle’s current state. *b. If at any time, the Author wants to start over: 1. Author asks to abandon work on the current puzzle. 2. System forgets all words and clues for the puzzle. 3. Use case continues from step 3. 1a. If an invalid (0 or negative) number was given for the number of rows or columns 1. System tells the Author that the numbers must be positive. 2. Author enters corrected number of rows and/or columns. 4a. If the letters of the word don’t match with one or more letters already assigned to the squares it crosses. 1. System tells the author what letters did not match. 2. System rejects (does not record the word). 3. Use case continues with step 3. 4b. If the word goes beyond the boundary or across at least one black square. 1. System tells the author of the error, and indicates which letters are in error. 2. System rejects (does not record the word). 3. Use case continues with step 3. 4c. If the word is misspelled 1. System suggests various corrections. 2. Author either accepts a correction or indicates that the word should be considered correctly spelled. 4d. If the word would cause a black square to be placed (see step 3) where there are already letters assigned for some other word. (I.e., the word is too short.) 1. System tells the Author of the error, and indicates which squares need letters. 2. System (does not record the word). 3. Use case continues with step 3. 4e. If the black square that the system would place at the end of the word (see step 3) would violate a design rule. 1. System tells the programmer how the location of the black square violates the design rule. 2. System r(does not record the word). 3. Use case continues with step 3. 6a. If the clue is empty. 1. System signals an error. 2. Author enters a non-empty clue. 6b. If a word in the clue is misspelled 1. System suggests various corrections. 2. Author accepts a correction. 3. System remembers the corrected word. 9a. If the puzzle cannot be saved. 1. System tells the Author that the puzzle cannot be saved. 2. Author enters an alternative file name for saving the puzzle. 3. System saves the puzzle in the alternative file name. Special Requirements - Display must support basic graphics. - Interface with external spell checkers Frequency of Occurrence: one time only per run of the program. Open Issues: More flexible spelling correction; Design layout rules; Internationalization. We suggest that you draw the domain model by hand on paper. You do not have to include attributes, only classes and associations. WHAT TO HAND IN You should have at the beginning of class, written answers to the above questions (or written out questions and problems you encountered for each part). Make sure your name is on these. Attach the printouts, if any, requested above. ADDITIONAL READINGS If you have time, read chapter 4 of Martin Fowler with Kendall Scott's book UML Distilled (Addison-Wesley Longman, Inc., Reading, MA, 2000).