0% found this document useful (0 votes)
91 views4 pages

Software Design Patterns Assignment - Behavioral Patterns

This document contains an assignment for a software design patterns course. It includes 3 questions about applying design patterns to image editing, dialog control, and updating dependent objects when XML data changes. For each question, the student provides the name of a suitable design pattern (Command, Mediator, Observer) and includes a class diagram to illustrate how it could be implemented.

Uploaded by

Rana Fathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views4 pages

Software Design Patterns Assignment - Behavioral Patterns

This document contains an assignment for a software design patterns course. It includes 3 questions about applying design patterns to image editing, dialog control, and updating dependent objects when XML data changes. For each question, the student provides the name of a suitable design pattern (Command, Mediator, Observer) and includes a class diagram to illustrate how it could be implemented.

Uploaded by

Rana Fathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CSE 425 – Software Design Patterns

Assignment 4

Rana Fathi Mohamed Mohamed Khodair


16P6070

Fall 2020
Question 1:
We have designed an image editor and user can have the option of opening file from various ways like menu, tool bar,
double click on a file in the explorer. Suggest a suitable pattern that enables users to open file in different commands.
Draw class diagram for this system.

Solution:

Suitable pattern is Command design pattern : similar to having an invoker that invokes a special command through
buttons, where each button has a purpose.

UML:
Question 2:
If we have the control library where we have a dialog and some controls over the dialog. The controls can be interacted
or can be changed by themselves. Suggest a suitable pattern that can control the interaction between different objects.
Draw the class diagram.

Solution:

Suitable pattern is the Mediator design pattern. The mediator implements the cooperative behavior by routing requests
between appropriate colleagues.

UML:
Question 3:
When any data is changed in the XML documents object it must notify the list of the active objects attached to the XML
document object and can update all dependent objects. Suggest a suitable pattern and draw class diagram.

Solution:

Observer pattern is a suitable pattern as the XML documents object will be notifying the active objects that use it.

UML:

You might also like