SE2811
Software Component Design

This is an old version of this course, from Winter 2014-2015. A newer version is avaliable here.

Objective

The objective for this lab is to extend the functionality of the drawing program to support "undo" of the folowing operations:

  1. Creation of new Shapes
  2. Combination of Shapes into Composite Shapes
  3. Decomposition of Composite Shapes

In addition, you will make the changes I suggested about the decorator pattern in your Lab 6 review.

Outcomes Addressed

Outcomes are the same as last lab.

Overview

As usual, we want to provide additional functionality while minimally impacting existing "legacy" code. In this case, you will make only minor modifications to the ShapeManager, DrawingProgramUI, and ShapeListUI classes, but will also create a Command interface with concrete classes implementing it and a CommandInvoker class.

Assignment

As a starting point, add the Command interface and implement the primary methods of the Invoker class. Then tie the Invoker into your GUIs to ensure it is called when expected.

Next, implement the Command class in concrete classes to provide the forward operation of the program. Finally, implement the undo operations.

To get a feel for how the classes should work together, consider the UML diagram below. If you wish, you may make changes to your implementation of the pattern (at the risk of revealing misunderstandings about it). If you choose to use inner classes (anonymous or named) for your commands, be sure to include them in your UML diagram with appropriate "inner class" connectors. You can put an "anonymous" stereotype instead of a name for the anonymous ones.

'A' Credit

For a full lab score, implement redo correctly. I have a thorough testing routine that I will run on your code in Lab 9 to confirm it works correctly. If you implement redo, describe what you learned in the process in the excellent credit portion of the report.

Submission Instructions

UML Class Diagrams

  • Include pattern stereotypes on each class in the diagram that is part of a pattern. For example, you might have a command CompositeCommand with the stereotype <<concrete command>> Some classes may have multiple roles; you can give these multiple stereotypes (or list all roles in a single stereotype)
  • Correct any errors from the UML diagrams submitted in Labs 1 and 2
  • All classes should have at least one connector to another class on the diagram
  • If a class is used in many places, lines should indicate the most significant places.
  • Useage lines should often be annotated with "creates" or "manages" or "uses" or other such remarks.
  • All instance variables relationships should have the variable name and access type marked on the arrow in the diagram
  • UML is an art. The goal is to communicate structure. Do you get a sense of the structure of your code when you look at your work?

Report

You will submit this lab in report format following this template with included zip through the web form. (So you will submit a txt, a UML class png, and a zip to the webpage.)

Be sure to comment your code properly

Your report should include the following sections:

Introduction

Describe the lab in 1 or 2 sentences for someone who hasn't heard of it (but knows last week's). You can assume that I'm your audience for the rest of the report.

Decorator Pattern

Describe anything you learned or questions you still have after making the edits in your Lab 6 review.

You may leave this section blank if I did not suggest any improvements to your implementation of Decorator in Lab 6.

Command Pattern

Describe how you implemented the command pattern. Reference your main UML diagram and describe how this pattern helped (or hindered) you to organize your code. This may be two to three paragraphs.

Excellent Credit Feature(s)

Describe how you implemented redo.

You may leave this section blank if you decide not to implement any Excellent Credit features.

Extra Excellent-credit sub-sections

I will not give much/any excellent credit for most activities beyond redo this week. If you wish to describe other improvements you made this week, you are welcome to do so. Please use the template from last week and include a subsectino for each feature you wish to describe.

Missing Features

Describe any missing requirements in a bulleted list. Any discussion of these is optional.

Please include a statement that there are no missing requirements if that is the case.

Conclusions

Based on this lab, would you use the Command pattern again (after this class)? "Yes", "no", "maybe yes", and "maybe no" are equally legitimate, just support your answer. (And make it clear whether you chose maybe yes or maybe no by following proper essay style. Ask me for details.)

Feedback on lab

Describe anything you enjoyed or could have been improved about the lab.

This section is not optional. Thanks to those of you who submitted feedback on the previous labs!

Acknowledgement

This lab developed by MSOE faculty.