Answered step by step
Verified Expert Solution
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 and Client and a Server class. The Server class supports the following
operations: HeapSort MergeSort BinarySearch and LinearSearch Client invokes HeapSort
and BinarySearch on the server. On the other hand, Client 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 should invoke Sort and Search where HeapSort and
BinarySearch are executed. Similarly, Client 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 decoupled from the issue of invoking appropriate
versions of Sort and Search Notice that in the design new classesoperations 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 pseudocode. In your design, all components should be decoupled as much
as possible. In addition, indicate which classesoperations are part of the strategy pattern and
which classesoperations are part of the abstract factory pattern.
Provide a sequence diagram to show how Client gets services HeapSort and BinarySearch by
invoking Sort and Search on the Server.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started