remove the start method from the Module interface #588
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While creating and updating modules I noticed one small annoyance that is sort of forced by the
Module
interface: since users are supposed to implement astart
method but obviously there are always a number of "things" that need to be instantiated for the module to work then we end up creating modules with a bunch ofvars
that are initialized with some sort of default value or defined asOption[X]
and then create the actual values whenstart
is called, but, in practice, there is no need to do that. All modules are instantiated right when they are going to be started, there is no chance to have an instantiated but not started module so I'm proposing to remove thestart
method from theModule
interface.Besides that change, I'm adding a
ModuleFactory
to be used when the modules are automatically instantiated by Kamon instead of provided by the user (which will be the default behavior).. this way, we force the parameter-less constructor only on the Factory and the Module itself is free to receive/grab any dependencies it might need on its constructor.