jimmymathews / graph-path

Explore graph structure at the command line
0 stars 0 forks source link

Basic refactoring the GUI class #9

Closed jimmymathews closed 4 years ago

jimmymathews commented 4 years ago
  1. Give much more descriptive names to the state fields and to the functions.
  2. Break up this class, perhaps in light of the Model-View-Controller design pattern. That is:
    • The Model is just the data model, including the current list of nodes, the current node query characters, etc., with no real behaviors.
    • The Controller is responsible for receiving key strokes and comprehending them as instructions for altering the Model and for altering the View state.
    • The View is responsible for outputting terminal codes and characters for the user to see some aspects of the Model state.
jimmymathews commented 4 years ago

Step 1 has not yet been attempted. The main idea of step 2 has been completed. The new classes GPModel, GPView, GPController are all there. I just moved all the member functions and variables from GUI to one of those 3 and "find-replaced" all occurences of these function or variable names to match their new homes. The functionality from before the refactoring seems to be present.

jimmymathews commented 4 years ago

Done. Also, the logic of partial and full completions was convoluted before, now a bit simpler.