Choreographing Complex App Start-Ups with RxJava

Complex and unruly initialization logic can be tamed into orderly, well-structured code with minimal effort.

A pilot reviewing his pre-flight requirements prior to engine start and take off.
Photo from Unsplash

Every app with even minimal complexity has what I like to call a pre-flight checklist. Is the user logged in? Do you need to hit a health check endpoint and respond accordingly? Is there a first-run experience that you need to skip? Seemingly unrelated questions like these need to be answered in one fell swoop during the start-up process.

Having been in this fray numerous times, I have seen (and written) initialization logic that ranges from spaghetti code to overly rigid and inflexible constructs that would require a manual to comprehend fully. By now, my team and I have landed on a flexible, elegant, portable, and battle-tested paradigm that has thrived in the stresses of development and production. Let's see what it looks like.