Prashant Priyadarshi
10/26/2020, 6:26 AMSe7eN
10/26/2020, 6:39 AMgildor
10/26/2020, 7:02 AMwisdom
10/26/2020, 11:11 AMAdam Powell
10/26/2020, 2:25 PMLauren Yew
01/04/2021, 9:12 PMAdam Powell
01/04/2021, 9:44 PMAdam Powell
01/04/2021, 9:47 PMinterface FooCalculator {
fun calculateFoo(input: T): Foo
}
and some other class that uses it:
class FooUser(
private val fooCalculator: FooCalculator
) {
fun doAThingWithAFoo(): Result
}
Adam Powell
01/04/2021, 9:47 PMAdam Powell
01/04/2021, 9:50 PMFooCalculator
that looks like this:
class MyFooCalculator : FooCalculator {
private val myInternalState by mutableStateOf(initialValue)
// ...
override fun calculateFoo(input: T): Foo {
return doSomeCalculation(myInternalState, input)
}
}
then you've introduced observability for code that uses a FooUser
with your observable dependencyAdam Powell
01/04/2021, 9:51 PM.map {}
, etc.