I have a hierarchy of Component and respective Sto...
# mvikotlin
s
I have a hierarchy of Component and respective Store, building on top of similar functionality. So at lower most I have a StoreFactory with a BaseExecutor extending from
CoroutineExecutor
and StoreFactories in upper levels extend this
BaseExecutor
My use case is, I want to do some logic process whenever a
BaseMsg
is dispatched, My first thought was to override the
dispatch method
in
BaseExecutor
and do processing by having a check in there. but the dispatch of CoroutineExecutor is not marked as Open. Is there a better way designed to support this use case or should I open a ticket suggesting marking dispatch as open ?
For now I have achieved this by just copying CoroutineExecutor Impl and marking the method open.
a
Both
dispatch
and
publish
methods just send the entity out of the
Executor
. You can add your own method in
BaseExecutor
, e.g.
handleMessage
and use it in descendants. This would make it explicit and also allow descendants to dispatch messages without processing in the parent if needed.
s
Yes makes sense having explicit behaviour for most cases. But I still do feel, having these as open to attempt at some certain usecases when certain logic always need to happen, and shouldnt let descendents override that behaviour. Will you be open to that change in library ?
a
In general, I would like to reduce the API surface as much as possible. E.g. if we make
dispatch
method open, then it won't be possible to add a default argument without breaking the source compatibility. But if you believe this change would significantly improve your experience (even though you can define your own method in the base class), then I think we can make those methods open. Plus similar changes in
ReaktiveExecutor
.