Are there patterns or best practices for modulariz...
# mvikotlin
s
Are there patterns or best practices for modularizing executor code. It seems like for complex state it can get rather large. We’ve devised an idea of
SubExecutors
that we delegate to. Each
SubExecutor
is responsible for managing a subset of data (usually 1-to-1 with a backend endpoint). It gets a little icky, though because
SubExecutors
sometimes need reference to each other — not the end of the world, but it feels like there should be a better way.
a
The main idea is to write separate stores. E.g. having one Store per screen is usually fine. If you see that some part of the screen is self-contained, you can extract that part into a separate Store. Executors are normal classes, you can just extract methods with callbacks.
SubExecutors
should also work.
s
The problem that we run into with separate stores is that there is usually some data that needs to be shared across the screens and there ends up being cross-store dependencies (eg when store A changes we need to fire an intent into store B). We haven’t really found a clean way to manage that.
a
Yep. You can send Labels from one store, and then map them to Intents of another store. That's the expected usage.
s
Ah, got it. Maybe we can give that a try.