Practical implementation of ideas presented in this DroidconUK 19 talk:
The immense benefits of not thinking in screens
Your view hierarchy is already a tree - RIBs gives you a way to compose your application in a similar way.
Break down the complexity of your project into manageable chunks. Compose them together to create abstractions on higher levels. Different levels - same approach.
RIB = business logic + UI + all related functionality packaged together, hiding all implementation details.
Use the same approach that works on any level of view-hierarchy:
- sections of the screen
- full-screen
- multi-screen flows
- pure business logic without any view
Achieve bare minimum coupling: RIBs are not coupled to their parents or siblings, and are easy to move around. Just provide dependencies to a Builder, and you are ready to go.
Fine-grained control over object lifetimes. Want to go more specific than a single @Singleton and @Activity scope? RIBs tree lends a natural and easy way to do this.
RIBs can be tested in isolation even in instrumentation tests
Compile-time safety over runtime crashes: you construct RIBs yourself, and can leverage constructor dependency injection.
Workflows allow you to chain operations of individual RIBs together. You can then trigger workflows from e.g.:
- console
- push notifications from deep links
Use it to easily move your app to specific states.
Badoo RIBs is an evolution of Uber RIBs, with notable differences and additions
- Tree structure is saved / restored automatically
- Reduced boilerplate code for
Router
by using routing actions and declarative routing - Added back stack for routing with back stack operations (push, pop, replace, etc.)
- Back stack is saved / restored automatically
- Separated
View
lifecycle from logicalNode
lifecycle, which adds many new interesting possibilities (e.g. RIBs with business logic still alive in back stack, RIBs hosted in an AlertDialog) - Support for Android lifecycle events
- Happily integrated with MVICore
- Enjoy full support for state management with async loading, one-time events, time-travel debugging, and more. Check documentation for a full list features.
- First-class support for unidirectional data-flow: one-liners for connecting endpoints
- Providing customisations for RIBs
- Template generator plugin compiled from live code templates
- Kotlin
See here. Check back later for more, as only basic functionality is covered as of yet. In the meantime, you can also check out the app-example
module.
This is an in-progress, preview version.
Bugs are probably less of an issue, as the framework is pretty well covered with unit tests, but API can change until 1.0.