r4 - 20 Apr 2007 - 18:14:26 - DarrinRotheYou are here: TWiki >  DrRothe Web  >  SoftwareComponentDesign > CompositePatternLab

CompositePatternLab

Objectives Addressed

  • understand and apply object-oriented design patterns
  • understand the use of UML in the design process
  • be able to do independent research on software design
  • be able to design and implement small software components and systems
  • be able to use computer-aided software engineering (CASE) tools in the design process

Overview

The purpose of this lab is to add features to an existing design, applying design patterns to minimize the impact of those changes.

Problem Statement

Background

By now, our drawing program is pretty solid. However, as our drawings get complex, the act of manipulating the current set of drawing primitives has become cumbersome. It is time to add new features. Going back to our original list of requirements, we might notice that we did not bring the copy/paste feature along. This will help. The ability to group primitives together to form groups will help as well.

Copy and Paste

Given our current implementation of ShapeList?, a feature such as copy and paste should be fairly straightforward. The real trick at this point will be the pasting - that is, adding the ability to copy objects and then repetetively preview the new objects and place them with the mouse might be a bit involved. Are there any patterns that come to mind? None of the patterns discussed so far in lecture seem appropriate. However, take a look at the "creational" patterns in the book for some ideas.

Grouping

Of course, we are looking at the composite pattern to help us out here. The intent of the composite pattern is to be able to represent groups of objects (Shapes in this case) the same an individual shapes. There are consequences of this pattern, but through careful design, starting with the use cases, we should be able to successfully apply this pattern and minimize the typical ripple of changes throught our code. When implemented, we should be able to group primitives, select them as a group (highlight them), and erase them as a group. We should also be able to copy/paste them, and ungroup them.

Assignment

Main Assignment

  1. Review your implementation of the observer pattern from the previous lab. Make improvements based on your instructor's feedback.
  2. Complete the "design" of the copy/paste feature. You will need:
    • Update to the UI
    • Use case(s)
    • Update to the domain model
    • Robustness diagram(s)
    • Sequence diagram(s)
  3. Complete the "design" of the group feature. You will need:
    • Update to the UI
    • Use case(s)
    • Update to the domain model
    • Robustness diagram(s)
    • Sequence diagram(s)
  4. Generate code and implement your design of the grouping feature at a minimum.

Questions

  1. What issues arose when designing the copy/paste feature? What patterns did you find that might help?
  2. What issues arose when designing the group feature? How did you deal with them?
  3. How did you deal with the issue of adding a primitive to a primitive?

Optional

  • Implement the copy/paste feature per your design.

Resources

  • See previous labs for starter projects.

DrRothe? Deliverables (due 11:00 p.m. the night before of week 7 lab)

Students should submit:

  • A pdf format report with:
    • Answers to questions posed above.
    • A short discussion about your experiences, and any problems you had with this project.
    • New diagrams generated for this lab - also include any changed diagrams that support new diagrams - for example, you should include:
      • Sequence diagram with the observer pattern in action (UC1 - Adding a Shape, and UC3 - Erase a Shape)
      • Updated class diagram showing observer relationships.
  • A .zip file with:
    • All source code for this project - no class files please.
    • A text file named manifest.txt. Within manifest.txt, list your email addresses (each team member, one per line), and all of the text and source files
    • Submit via electronic submission at online submission as Lab 5.
    • Do not include EA file with this submission.
    • Your zip file should not have any subdirectories except for Java packages associated with your souce code. Indicate subdirectories with '/' not '\'
  • Log your time spent on this assignment to FAST.

DrTaylor? Deliverables (due 11pm the day prior to week 7 lab)

Students should submit two files per group:

  • An .xml file with:
    • Answer to questions posed above.
    • A short discussion about any problems you had with this project.
    • Links to the UML diagrams (see below).
  • A .zip file that has .png or .gif images of:
    • Updated UML diagrams that show the composite pattern in use (called 2811 login L5?.png) where login is the actual login name for one of the members in your group and ? is a letter of the alphabet.
    • Note: The class diagram should include all methods, attributes and associations required to implement the Composite Pattern.
Also, be sure to submit a log of time spent on this assignment to FAST and be ready to demo your program at the beginning of week 7 lab.

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback