Subjects and top-down reactive programming
Composing Observable
objects is similar to composing functions, collections, or futures. Complex Observable
objects are formed from simpler parts using functional composition. This is a very Scala-idiomatic pattern, and it results in concise and understandable programs.
A not-so-obvious downside of functional composition is that it favors the bottom-up programming style. An Observable
object cannot be created without a reference to another Observable
object that it depends on. For instance, we cannot create an Observable
object using the map
combinator without having an input Observable
object to call the map
method on. In a bottom-up programming style, we build complex programs by implementing the simplest parts first, and then gradually working our way up. By contrast, in a top-down programming style, we first define the complex parts of the system, and then gradually divide them into successively smaller pieces. The top-down programming style...