SDA SE Wiki

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

User Tools

Site Tools


Assignment 09: Design Patterns 2

Release date: Tuesday, 09.06.15 - Due date: Sunday, 14.06.15, 23:59

You can find a file A09_DesignPatterns in your repository. It contains templates for all the tasks plus more.

Task 34: Anonymous Instances

8 points

This task follows a similar idea as our hunt for gangsters in the second assignment.

In the file you will find some anonymous untyped instance specifications (“objects”) with some links between them. Next to each group of instances there is a note with the name of all the design patterns that we presented. Check whether the group of objects could be instances of the classes in the design pattern. If they can not be instances of the respective design pattern, delete the name in the note.

To be more precise:

  • You find the class diagrams of the design patterns in the file.
  • The links can be instances of associations as well as aggregations.
  • None of the objects is meant to be an instance of the Client class.
  • There is no value given, even if the class has attributes.

The first “group” for example is just one instance. As you need more than one object for the Adapter Pattern, you should delete “Adapter” from the note next to the first group. And so on.


Task 35: Abstractness Stability Diagram

8 points

Place the classes and interfaces of an example of one of the patterns (not the Observer pattern) in an Abstractness-Stability-Diagram. You can find the Observer example from the slides with some comments in the file. Describe for each class and interface, why you have placed it at its location1), i.e. discuss the abstractness and stability of the classes and interfaces. Discuss whether SAP, ADP, DIP and SDP are respected.


Task 36: Design Patterns and Layers

8 points

a) Pick a design pattern that might be distributed over two layers and place the classes and interfaces on the higher or the lower layer respectively. You can find an example in the file. Of course you should give us something different from our example. Describe the consequences of distributing the pattern over two layers in two or three sentences!

b) Pick another design pattern that might be distributed over two layers and place the classes and interfaces on the higher or the lower layer respectively. It should of course again be different from our example. Describe the consequences of distributing the pattern over two layers in two or three sentences!


Task 37: Command Pattern Extended (partially optional)

3+3[+6] points

You may ignore the undo operation in a) and b).

a) Give an example of the Command pattern. Describe the implementation of relevant operations in pseudo code.

b) Add support for a MacroCommand, i.e., a command that consists of commands. Describe the implementation of relevant operations in pseudo code.

c) [optional] Add support for an UndoCommand, i.e., a command that undoes the previous command, and then the command before, and so on. Describe the implementation of relevant operations in pseudo code. Give as well the implementation of the undo operation in the MacroCommand as well as in another command.


1)
If you placed classes or interfaces next to each other to keep them visible although they have the same abstractness and stability, just add a note about that.
teaching/lectures/oosc/2015/assignment_09.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024