Czar
10/15/2019, 2:19 PMclass DoSomethingCommand : Command in DoSomethingCommand.kt and class DoSomethingCommandHandler : CommandHandler<DoSomethingCommand, R> in DoSomethingCommandHandler.kt
2️⃣ same as above but in one file, e.g. DoSomething.kt
3️⃣ Command handler is an inner class of the command: class DoSomethingCommand : Command { class DoSomethingCommandHandler : CommandHandler<DoSomethingCommand, R> }
If that matters, command dispatcher is used, so handlers are only addressed directly in tests, otherwise it's commandInstance.execute() where fun Command.execute() = /* get command dispatcher from static context and dispatch the command */tseisel
10/15/2019, 7:40 PMDoSomethingCommand.DoSomethingCommandHandler is quite a long name, but if handler is not referenced everywhere in the code, DoSomethintCommand.Handler makes perfectly sense.Czar
10/16/2019, 9:26 AMinternal commands.
Our main argument for this setup in our specific case is that we decided to have an ***.api package which commands along with other API stuff belong to, while handlers are in other packages. This was decided because this'll make it easy to split the API into a separate lib if and when we need that.