dilemma modeling classes like `UseCase`, for examp...
# getting-started
m
dilemma modeling classes like
UseCase
, for example, or anything else that has common structure and needs input and output parameters: 1. having
UseCase
interface like this:
Copy code
fun interface UseCase<Parameters, Result> : suspend (Parameters) -> Result

class SomeUseCase : UseCase<String, Int> {
    override suspend fun invoke(parameter: String): Int = parameter.toInt()
}
2. extending function for every instance:
Copy code
class SomeUseCase : suspend (String) -> Int {
    override suspend fun invoke(parameter: String): Int = parameter.toInt()
}
2nd approach allows for passing multiple parameters instead of just one with 1st approach we need to group parameters inside an
data class
and unpack then when we need them which makes sense because those are cohesive information for given
UseCase
am open for ideas/suggestions