SDA SE Wiki

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

User Tools

Site Tools


Assignment 7: Design Patterns

Due at Friday, June 26th, 23:59

Task 15: Proxy Pattern

3 points

Due to legal reasons, only movies rated suitable for persons under the age of 18 are allowed to be viewed publicly on the MMM web portal. Because of this, we want a way to establish an access control proxy for the list of movies.

  • Check out the “MoviesInPublic” project from your repository.
  • We already created the structure of the proxy pattern. Implement the missing class.
  • Do not modify anything else, especially not the tests.
  • Make sure both tests succeed.

Task 16: Observer Pattern

5 points

A screenshot of the Chatter app

For this task, you will need to install RAP1) 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”.2)

The Task

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

Check out the “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 17: Mediator Pattern and Abstractness-Stability-Diagram

4 points

In this task you will learn how to use the Abstractness-Stability-Diagram to decide whether a certain design pattern is appropriate or not. As the pattern wasn't covered in the lecture we quickly introduce it here:

The Mediator Pattern

  • The Mediator pattern is a behavioural pattern.
  • Interaction between different colleague objects gets encapsulated in a mediator object.
  • The Mediator defines all possible interactions between the colleagues.
  • A ConcreteMediator then implements these interactions between the ConcreteColleagues.
  • If a ConcreteCollegue wants to communicate with another ConcreteCollegue they will not communicate directly, but through the ConcreteMediator.
  • So there is no coupling in between the ConcreteColleagues but only between the ConcreteColleagues and the ConcreteMediator.

Your Task

  1. Draw an Abstractness-Stability-Diagram3) for the mediator pattern.
    • Is the position of every class unambiguous?
    • Which assumptions do you have to make?
  2. Find an example where the usage of the mediator pattern is useful.
    • Draw a class diagram that shows which part of your example corresponds to the classes of the pattern shown above.
1)
which we plan to use for the MMM
2)
don't forget this!
3)
See slides 7ff in 2009-06-17 OOSC Lecture.pdf for the general explanation and slides 7f in 2009-06-18 OOSC Lecture.pdf for the example with the observer pattern
teaching/lectures/oosc/2009/assignment_7.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019