badoo / MVIKotlin

Extendable MVI framework for Kotlin Multiplatform with powerful debugging tools (logging and time travel), inspired by Badoo MVICore library
https://arkivanov.github.io/MVIKotlin
Apache License 2.0
825 stars 66 forks source link

Consider better names for Action and Result #304

Open arkivanov opened 2 years ago

arkivanov commented 2 years ago

Currently Actions are sent from Bootstrapper to Executor and Results are sent from Executor to Reducer. But sometimes it might be confusing, because we need to send an action to the Reducer, or a result to the Executor. Maybe we should find neutral names instead?

Nikola-Milovic commented 2 years ago

Can you elaborate on this part @arkivanov ?

we need to send an action to the Reducer, or a result to the Executor

What would be an example of sending an action to a Reducer or a result to the Executor?

arkivanov commented 2 years ago

@Nikola-Milovic

What would be an example of sending an action to a Reduce

If a Store don't need any async processing, then the Executor can be avoided, and so the Reducer processes Intents directly. Intents are calls to actions, they are usually written as imperative verbs, e.g. Intent.RemoveUser. In this case the Reducer processes commands, not results.

Another case could be, when you did some calculations in the Executor. And as a result you might want to express a command to the Reducer to change the state in some way.

Another case is when you actually have Executor, because some of the Intents needs async processing, but some of them do not. E.g. if you have Intent.ToggleFavoriteStatus, then in the Executor it is inconvenient to express it as a result. It is still a command, just redispatched.

a result to the Executor

There are cases when you subscribe to events in the Bootstrapper, for example server notifications. You might want to dispatch something like UserSignedOut, which is an event, not an action.

arkivanov commented 2 years ago

Moved to https://github.com/arkivanov/MVIKotlin/issues/6