Question: There exist two clients ( Client - 1 and Client - 2 ) and a Server class. The Server class supports the following operations: HeapSort

There exist two clients (Client-1 and Client-2) and a Server class. The Server class supports the following
operations: HeapSort(), MergeSort(), BinarySearch(), and LinearSearch(). Client-1 invokes HeapSort()
and BinarySearch() on the server. On the other hand, Client-2 invokes MergeSort() and LinearSearch()
on the server. The current design is shown below:
In a better design Clients should be shielded from different versions of sorting and searching. In the new
design, as shown below, Client-1 should invoke Sort() and Search(), where HeapSort() and
BinarySearch() are executed. Similarly, Client-2 should invoke Sort() and Search(), where MergeSort()
and LinearSearch() are executed. Notice that the current design does not support this option.
Use the strategy pattern and the abstract factory design patterns to solve this problem. In your
solution, the Client classes should be completely de-coupled from the issue of invoking appropriate
versions of Sort() and Search(). Notice that in the design new classes/operations should be introduced
according to these patterns.
Provide the class diagram and describe the responsibility of each class and the functionality of
each operation using pseudo-code. In your design, all components should be decoupled as much
as possible. In addition, indicate which classes/operations are part of the strategy pattern and
which classes/operations are part of the abstract factory pattern.
Provide a sequence diagram to show how Client-1 gets services HeapSort() and BinarySearch() by
invoking Sort() and Search() on the Server.
 There exist two clients (Client-1 and Client-2) and a Server class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!