Wednesday, March 26, 2008

Project 3a

Due Date: Friday, 4 April (firm!)

Team project

Objectives

An understanding of
  • Requirements analysis
    • functional requirements
    • nonfunctional requirements
    • constraints/goals
  • Modeling
    • UML class diagrams
    • UML sequence diagrams
  • Design patterns
    • Designing to an interface
    • Composite pattern
    • Decorator pattern
  • Technical writing: form, style

Description

In this project, you will analyze the requirements for a simple API (application programming interface) for drawing graphical shapes and produce an analysis model in the form of a class diagram. There is no coding in this project, but you will implement the resulting API in the next project.

Functional requirements

The API allows you to create circles and rectangles of different sizes, foreground colors, and background (fill) colors at different locations on a coordinate system. In addition, the API allows you to group multiple shapes together and treat them (in terms of specifying location or color) as if they were a single shape.

The shapes created using this API (including groups or shapes and shapes with specific colors or at specific locations) have the following capabilities (responsibilities):
  • drawing the shape to a visual drawing area
  • computing the shape's bounding box, defined as the smallest enclosing rectangle

Nonfunctional requirements

The API implementation must avoid duplication of features or responsibilities across classes and provide high flexibility by using suitable design patterns.

In particular, you can apply any combination of the following additional structural elements to any shape (simple or grouped):
  • location information
  • foreground color
  • fill color
  • grouping with other shapes
Furthermore, any resulting shape structure uniformly supports the draw and boundingBox operations described above.

Constraints/Goals

The analysis model should translate readily into a set of Java types (classes and interfaces).

Examples

The following code snippets illustrate the vision for how the API will be used.

Shape s = new Group(
new Foreground(Color.BLUE, new Rectangle(20, 10)),
new Location(100, 0, new Group(
new Background(Color.RED, new Circle(5)),
new Circle(10),
new Circle(15)
));
Graphics g = ...
s.draw(g);

The resulting shape (see screenshot at the top, which also includes the bounding box) will consist of
  • an unfilled rectangle of width 20 and height 10 and a blue outline with the top left corner at the origin (in Java, the y-axis extends downward)
  • three concentric circles of radii 5, 10, and 15, respectively, 100 units to the right of the origin, where the two outer circles are unfilled and the inner one is filled with red color

Deliverables

There are two deliverables for this project:
  • (50%) A detailed UML class diagram showing your analysis model. The diagram should show any relationships among classes (in some cases, there is more than one relationship between two classes). Furthermore, the classes in the diagram should include the following elements where applicable:
    • operations (methods)
    • attributes (instance variables)
  • (50%) A brief paper describing the analysis and modeling process you went through, including:
    • (15%) Your rationale for identifying/choosing exactly those classes shown in your diagram.
    • (15%) For each design pattern you choose to apply, a brief explanation of the problem this pattern solves in the particular context of the shape drawing API.
    • (10%) Any other comments, reflections, questions, doubts, or other thoughts you have at the end of this process.
    • (10%) Be sure to write effectively, following the general guidelines and the theoretical or practice article form from this resource. Your work is evaluated based not on length, but on accuracy, conciseness, and style. You should aim for a total of two to three pages.

Modeling software

You may produce your class diagram in any one of the following ways:
  • Draw by hand and scan to some image format or PDF.
  • Draw using a general drawing program such as Microsoft Visio.
  • Draw using a modeling tool such as ArgoUML (free).

How to submit

Please refer to the online submission procedure. Each team is to make exactly one submission. The written paper must be submitted either as a PDF document or through Google Docs. The class diagram must be submitted both in the tool-specific format and a general image format or PDF.

No comments: