SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Assignment 9: Object Design

Due at Friday, June 25th, 23:59

Task 31: Proxy Pattern

4 points

Consider the following instance of the proxy pattern representing the structure of images in a website:

  1. A website w contains two embedded images i1 and i2. The browser already loaded i1, but not i2. Draw a sequence diagram showing two calls to the method Image.draw(), the first on i1, the second on i2.
  2. Transform the classes including the aggregation association, the inheritance relation as well as the class' methods to Java source code. Do not specify the internal details of the draw() method.

Task 32: Observer Pattern

5 points

A screenshot of the Chatter app

For this task, you will need to install RAP into Eclipse.

RAP installation

  • under “Help”→“Software Updates…” select the tab “available software”
  • click “add site” and add the following URL:“http://download.eclipse.org/rt/rap/1.2/update
  • a new item “RAP Update Site” appears in the list.
  • check the latest version of the “Rich Ajax Platform SDK” and click install.
  • After the installation has finished, restart eclipse.
  • If the welcome screen does not show up, select “Help”→“Welcome” and click on the globe icon (welcome).
  • On the welcome screen, select the “rich ajax platform (RAP)” and choose “Install Target Platform”.1)

The Task

We've created a simple chat application called “Chatter” with RAP.

Check out the “A9T16_Chatter” project from your repository.

The application has a certain problem: Once a client starts it, the messages are loaded from the shared MessageHistory, but afterwards, nothing is updated. You can't even see your own messages!

Your task is to implement an Observer Pattern to solve this problem.

Take a look at the class diagram for the Pattern. You'll notice that all the needed concrete classes and their functionality are already there, they just don't interact the way we want them to.

Task 33: Composite Pattern

4 points

Write a program that demonstrates the advantages of the Composite design pattern. The program should create a tree of objects consisting of both composite and leaf nodes (demonstrating that the composite has correctly implemented a subset of the child management functions, such as addChild(), getChild(), and getParent()). Make sure that your tree consists of at least three levels, e.g. a root node with multiple children, where at least one of those nodes is a composite node with children. The program should then call an operation on the root of the tree. All composite objects should delegate the operation to their children while all leaf nodes should perform the action. Optionally the composite nodes can do something in response to the operation but they should then delegate the operation to their children.

Task 34: Implementation Inheritance

3 points

Describe the Liskov's Substitution Principle in your own words. For a more detailed discussion see

Java Boutique - Liskov's Substitution Principle & Design by Contract.

Is overriding in general a dangerous concept?

Task 35: Breaking the Cycle (optional)

2 points

Take a look at the cyclic dependency expressed in the following UML class diagram: Can you think of a way to break this cycle without loosing any functionality?

Hint: there is a well-known design pattern that is typically used in situations like this.

1)
don't forget this!
teaching/lectures/oosc/2010/assignment_9.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019