Cracking Android SDE2/SDE3 Interviews in 2026: Deep Dives, Code, Follow-ups | Part - 3
Architecture & Patterns Find Part -1 From Here Find Part -2 From Here 31. MVI Reducer? MVI Reducer (with Error Handling) Reducer in MVI is a pure function that takes the current State and an Intent and returns a new State . Key properties No side effects (no network, DB, coroutines) Deterministic and replayable 100% unit-testable State is immutable State @Immutable data class OrderState ( val items: List<OrderItem> = emptyList(), val loading: Boolean = false , val error: String? = null ) Intents (User + Result) sealed interface OrderIntent { data object Load : OrderIntent data object Retry : OrderIntent data class AddItem ( val item: OrderItem) : OrderIntent data class LoadSuccess ( val items: List<OrderItem>) : OrderIntent data class LoadFailure ( val message: String) : OrderIntent } Reducer (Pure) class OrderReducer { fun reduce (state: OrderState , intent: OrderIntent ) : OrderState = ...