I'm working on a module that I'm hoping to be somewhat dynamic, in that anyone can add features relatively easily.
The basic idea is to have a class, CriticBase, which handles all criticisms for this deployment. The critics would be any class that has inherited from CriticBase.
Pseudo Example:
class CriticBase(Object) {
def self.Execute():
for critic in self.__subclasses__: critic.run()
}
class DatabaseCritic(CriticBase) { def run( //things ) }
class DiskSpaceCritic(CriticBase) { def run( //things ) }
etc...
def DoWork():
Controller = CriticBase()
a = DatabaseCritic()
b = DiskSpaceCritic()
...
Controller.Execute()
I hope that kind of makes sense. Basically the idea is to have a framework that's fairly straightforward for other devs to add to. All you need to do is define some subclass of CriticBase, and everything else is handled for you by the critic framework.
However, it's pretty ugly to me to just assign these classes to something that's never going to be used. Is there such a thing as lingering objects in Python? Could I do away with the assignment, and still have the reference to the instantiated class from the base class? Or do I have to have it assigned to something, otherwise it will be garbage collected?