Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor modularity #1

Merged
merged 15 commits into from
Jan 30, 2019
Merged

Refactor modularity #1

merged 15 commits into from
Jan 30, 2019

Conversation

crimsonFig
Copy link
Owner

Refactored/overhauled several key structure implementations

removed co-dependencies and loosen coupling wherever possible

  • class structure now uses a layered design with dependency inversion to form a one way dependency tree.
    • the layers goes from Sylladex (lowest level) to Modus (high level), abstracting with models
    • Sylladex (controller) depends on ModusManager (container) to interface with the Modus
    • ModusManager depends on ModusBuffer (model) and Modus (sub-controller)
    • Modus depends on ModusBuffer, Metadata (model), and Card (model)
  • the layered design also uses generics, data encapsulation, and polymorphism to achieve modularity
    • the ModusManager uses the Modus interface in conjunction with lambdas in a CommandMap to dynamically execute functionality from the currently connected Modus
    • the ModusBuffer encapsulates data and provides required data to the Modus while also buffering this wrapped data between any swapped Modus objects.
    • the Sylladex provides all required information in wrapped objects to enable soft linkage of data and allow the Sylladex to hold data manipulated by the Modus without having to collect it, utilizing the 'double pointer/reference' pattern design used in the C language.

untangled older monolithic, spaghetti-esque code and purified code smells

  • refactored a lot of code to be more modular, reducing redundancies, and streamlining complexities
  • utilized more SOLID and GRASP principles of 'OO design' within redesigned structure
  • broke down several classes and methods that were becoming monolithic to improve modularity, maintainability, and testability

improved the testability of the code

  • utilized 'decomposition of responsibility' and 'data encapsulation' to make methods of classes more testable; focus is more on interfacing with what is promised and less on implemented procedure
  • utilized strong exception handling practices to make debugging information more expressive and easier to find

Modus subclasses no longer depend on a Sylladex object reference
Some additional refactoring to extend the previous commit so that it
covers the forgotten #.refreshModus() method
Fully replaced the entry method with a Hashmap of command name and
routed consumer objects - contained in new `CommandMap` class. Added
more getter/setters to ModiMgr to shorten chain calls. Sylladex
refactored in response to these changes.
Sylladex now has it’s own CommandMap object. Also now constructs a list
of all command names once (during modus selection) instead of every
time the list is needed. Also cleaned up many snippets of code to
reduce lines and increase readability.
Searcher now works with (almost) all collections instead of just List.
This reduces the overall call chains for formatting beforehand.
the ModusManager now collects the modus by filtering out invalid modi during the modus name to modus class object conversion step. Only instantiated a modus class when required and only holds onto one modus object reference at a time. using class objects is stronger than stringly names while being more modular by not trying to instantiate everything it can the first go around. Updated other classes code to reflect this implementation change. Added custom annotation and validation methods to help with the modus filtering process. Reformatted the code for better organization.
created ModusBuffer to act as a buffer that contains all the required data a modus would need to access and support modus hot swaps using the inverted dependency technique. sylladex was refactored to not share static objects and instead pass wrapped objects to the modus buffer on modus manager construction. sylladex is pruned of unnecessary dependencies. modus manager now handles modus input and acts as an API for the modus to the sylladex using the facade pattern technique. Modus now relies on the modus buffer for data from the sylladex, using the modus buffer's public getters.
the write and load methods were encapsulated into a File Controller to promote Single Responsibility of the sylladex.
created a util package to handle the command maps. created a case-insensitive map for handling command strings if desired. created an abstract command map class that implements the constructor and delegates map methods using composition and delegation pattern. created modus and sylladex command maps that extend the command map and add command execution specific methods. These features were added to make minimap impact to previously implemented. Minimal refactoring to other code where required for supporting the new types.
Removed unused classes within package. Removed unused methods within Searcher class. Marked in-use methods within Searcher class as deprecated. These changes should have no impact on other code as the changes affected unused code.
hotfixed a typo that affected the Searcher class' import declarations.
* moved the modus package to be within the app package. reasoning: the modus classes are tied close enough to the app package and won't exist elsewhere.
* moved the ModusBuffer class to the model package. reasoning: the class acts as a buffer of data and is responsable for holding application state, so being a model for the modus classes makes sense.
* removed Searcher class;
* updated modus class methods that used the deprecated fuzzy search method so that they can operate non-fuzzy.
* updated several pentafile methods to reduce redundency and promote better communication on failure
* fixed a bug in ModusManager that caused construction to fail if using a name of a nested package (as opposed to the root package).
* fixed all compilation-time errors in Modus subclasses, specifically corrected method signatures only to the extent that they can compile without throwing an error. They have yet be implemented, nonetheless.
* added several custom exception classes to the util package for use in Modus and ModusManager classes. These enable more expressive handling of the various kinds of exceptions with differing severity that a Modus class may throw; especially given the more 'blind' execution nature of the Modus classes.
* fixed a few logical bugs within PentaFile class regarding card retrieval
class diagram no longer reflects current application state
@crimsonFig crimsonFig self-assigned this Jan 30, 2019
@crimsonFig crimsonFig merged commit c5cb302 into master Jan 30, 2019
@crimsonFig crimsonFig deleted the refactor-modularity branch January 30, 2019 21:52
@crimsonFig
Copy link
Owner Author

Refactor branch complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant