N26 Lucia Payo Sep 5, 2017

Reactive Clean Architecture with Android Architecture Components

Article Summary

Lucia Payo from N26 reveals how combining RxJava, Clean Architecture, and Android Architecture Components created a system where code writes itself faster over time. The secret? Infinite data streams that never complete.

N26's Android team built a reactive architecture that treats core app data as永久 observable streams rather than one-off API calls. This approach separates concerns across three layers (Data, Domain, Presentation) while using RxJava to handle asynchronous complexity and Android's ViewModel/LiveData for the UI.

Key Takeaways

Critical Insight

N26's reactive clean architecture makes features easier to navigate, code faster to review, and development progressively faster as reusable components accumulate.

The article includes a critical warning about the async trap that corrupts state and causes race conditions (plus how RxJava operators solve it).

About This Article

Problem

N26's developers struggled with asynchronous programming. Race conditions and corrupted states kept happening because they were storing intermediate results in local variables while processing reactive streams.

Solution

Lucia Payo's team made all objects immutable and removed unnecessary internal state. They used RxJava operators that were built for reactive asynchronous environments instead of manually managing variables.

Impact

The team could build faster as reusable components grew over time. Code reviews became easier because concerns were clearly separated, and new features took less time to implement.