Skip to content
Commitwise
Menu

Use case

Also called: Interactor

A small class in the domain layer that holds one business rule or action, reused by several screens.

Definition

A use case usually has a single public function (in Kotlin often operator fun invoke) and depends on repositories or other use cases. It is worth adding when a rule is shared or complex enough to test on its own; a use case that only forwards a call to a repository adds a file without adding value.

In practice

FreeShippingUseCase decides whether a cart qualifies for free shipping, for both the cart and the checkout screens.

Related terms

Esc

Type to search the whole site.