Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions