spydrnet icon indicating copy to clipboard operation
spydrnet copied to clipboard

Clean up the namespace managers' implementations

Open thunder-hammer opened this issue 3 years ago • 2 comments

Currently the namespace managers are somewhat confusingly implemented.

  • They use static methods that are difficult to override but the EdifNamespace and DefaultNamespace share most of the same code.
  • The class that inherits from the callback class to implement the callback portion is created in __init__.py

There are some things that could be easily refactored to help future contributors and make maintaining the namespace managers much easier. Some suggestions:

  • Convert all the static methods to class methods. These appear to be easier to override in an inheriting class.
  • Break the callback override out of the __init__.py (this would just make finding everything easier)
  • Make the EdifNamespace class inherit from the DefaultNamespace class.

I think with these clean ups the namespace manager could be come a better example of how to implement a plugin using the callback framework.

thunder-hammer avatar Jun 02 '21 19:06 thunder-hammer

Just made the static methods class methods.

Then I made the EdifNamespace inherit from the default namespace and removed unchanged methods.

thunder-hammer avatar Jun 02 '21 20:06 thunder-hammer

The inheritance could be further cleaned up by replacing large sections of logic with calls to super()

thunder-hammer avatar Jun 02 '21 20:06 thunder-hammer