dave08
03/27/2024, 11:02 AMUlrich Schuster
03/27/2024, 12:07 PMdave08
03/27/2024, 12:12 PMdave08
03/27/2024, 12:24 PMUlrich Schuster
03/27/2024, 12:30 PMfun myEnrichmentStep2(val in: Step2): Step3
makes sure that you only work on the appropriate types for each stagedave08
03/27/2024, 12:38 PMdave08
03/27/2024, 12:40 PMUlrich Schuster
03/27/2024, 12:42 PMdave08
03/27/2024, 12:43 PMUlrich Schuster
03/27/2024, 12:51 PMdave08
03/27/2024, 12:57 PMfun interfaces
, so they're easy to replace for testing. I think you have a good point... each one could technically return only what they are adding... I think I'm not yet used to "functional thinking"... and my current implementation was mutable, so I didn't really notice that pattern. I guess the reason was to "over-optimize" things... but it makes things more complex to reason about and test... Thanks for your advice!raulraja
03/27/2024, 2:45 PMUlrich Schuster
03/27/2024, 2:49 PMdave08
03/27/2024, 2:50 PMsealed interface Action
sealed interface ActionWithKey : Action {
val key: Key
}
data class Action1(...) : ActionWithKey
data class ActionEnriched(val action1: Action1, val enrichment:...) : ActionWithKey
...
data class FooResponse(
val bar: Map<Key, ActionWithKey>,
val baz: Set<Action>
)
fun interface UseCase1 {
operator invoke(currResponse: FooResponse): FooResponse
}
...
this is my current attempt... while trying to migrate to something better...dave08
03/27/2024, 2:52 PM