Linoy and Yael - Second part of project - EVEN2.
Submission Date: 01/30/2020
Hello readers!
The Goal - Creating a server that will handle multiple clients and will solve different problems. This shall be achieved using the SOLID principles, by implementing serveral Design Patterns.
The project is based on several main components:
-
Deep understanding of programming in a multi-threaded environment.
-
Taking advantage of OOP's polymorphism - We created several classes according to the UML diagram receieved. Each class implements an important part of the logical proccess. For intance: Server - a class that will function as a server (a parallel/ serial one, accordingly) ClientHandler - a class that will manage resolving problems with a given algorithm, and will return the solution to the client. DFS, BFS, AStar, BestFirstSearch - Those are the search algorithms that were implemented.
-
Full understand of CPP syntax, including data structures, libraries etc. This entire project is written in CPP.
-
Full understand of CPP templates.
-
Understanding the Adapter design pattern in CPP: This DP is neccessary in order to connect between the Solver and the Searcher interfaces.
-
Understanding the Bridge design pattern in CPP: This DP was neccessary in order to seperate the different search algorithms and the problem it was meant to solve.
-
Understanding and Taking advantage of storing different solutions in Files (Caching).
Those are classes that implement the Server interface. Each of them handles clients differently; The serial server accepts and handles clients one by one. On the other hand, the parallel server accepts and handles clients at the same time.
MyTestClientHandler is used within the serial server. It receives a string line and creates a StringReverser that will reverse the string given. The reversed string will then be returned to MyTestClientHandler and later on, to the client.
This is a class that implements the Searchable interface (with string as T). By creating this class, we are able to define a search problem on a graph (matrix) given on part C. We'll be able to return a shortest path from one cell of the matrix to another cell.
This is a class that is used within the parallel server. It will create an ObjectAdapter and set its' algorithm to AStar MyClientHandler will set the ObjectAdapter creates as its' solver. By doing so, we make sure the OA will be the responsible component that will solve, store, and return a problem-matched solution. This solution recieved will be sent to the client.
The FileCacheManager implements the CacheManager interface. Everytime our Solver is asked to solve a problem, we will first check if a solution to this specific problem already exists in our filesystem. If so, we don't have to solve this problem again, what saves us precious runtime. The already-cached-saved solution will be returned to the client (using MyClientHandler).
The solver interface receives a problem and returns a matching solution. The inner implementation of the solver depends on one of the mentioned above algorithms. Each of those algorithms are implemented using templates. One can conclude that the Astar algorithm time complexity is the best.
- We made an empirical experience on 10 matrixes. We have tested each of our implemented search algorithms - DFS, BFS, BestFirstSearch and AStar.
Our final conclusion was that the AStar algorithm has the best performance rates. Furthermore, we've decided to set the main current search algorithm to be AStar.
Thanks for reading!
Yael and Linoy :)