Closed mcmehene closed 9 months ago
The interface is implemented to the best of my knowledge, the only way I could see improvement is by possibly making generic typing for the methods, but I think I need more practice before implementation and testing.
After researching more about the SOLID principles and Java generic typing I have decided to rewrite the solver interface to only include two methods but also have two generic types.
The first method is used to find the starting row coordinate of the maze since we are not giving the starting coordinates and must find it. The second method is to find the end row coordinate. For the type of maze being passed in for this specific project, no matter which algorithm is implemented, the start and end coordinate will need to be found. As such, I have these methods as an interface so that they can be reimplemented in different solving classes.
The first generic type relates to the return type of the coordinate. The developer can return an integer which is what I am doing, or they can return a String, I'm not really sure but that's the beauty of the generic types. The second generic type is based on the maze type passed into the interface methods. Since I have created a Maze Creator class that uses a generic type to save the maze, so different and possibly better data structures can be implemented, it would be good to enable the developer to use that generic type when passing the maze into the methods.
To follow SOLID principles more accurately, I plan on implementing a Solver interface to my MazeSolver class. This will enable the right hand algorithm to be developed by the general methods I think can be used for other algorithms as well. The interface will also enable adding multiple new methods so that it will enable solving mazes using different algorithms.