Advantages of RIB(Router, Interactor, Builder)

RIB(Cross-platform architecture framework)

RIB is the cross-platform architecture framework designed by uber for mobile apps with many engineers and nested states. RIB is short for Router(routing between RIBS), Interactor(contains business logic), and Builder(instantiate all the RIB’s constituent classes), which are core components of this architecture. RIB is famous for its SOC and state handling.

In this article, I want to talk about the advantages of RIB in general. In the following articles, I explain the disadvantages of RIBs.

Why uber decided to create RIBs?

According to the uber-blog, they had many reasons to create RIBs architecture and framework, which you can see below.

Technical dept

The uber mobile codebase grew, and new features were added quickly, the technical debt was extremely high, and they could not practically add a new product.

Product Challenges

According to Uber, many products were added to the app quickly, different for each country. Some countries even had several additional features compared to other countries, and previous products changed, making it virtually impossible to add products in the end. Or update.


Ride-hailing apps have many states, and handling these states is not easy in common mobile architectures.

Uber already knew that writing a new framework and architecture would take time, so before that, it researched most of the designs pattern, concluded that they each had a problem, and decided to create RIBs.

RIB Advantages

  1. SOC
  2. State Handling
  3. Deep Scope Hierarchies
  4. Cross platform
  5. Tooling


We designed RIBs to encourage code isolation, letting each team, feature, or component have its own workspace.

In RIBs, each feature can have a view, or it can be viewless. Each unit contains the main elements of RIBs router, interactor, builder, and view (if not view-less). Each feature provides dependencies from the parent with a simple interface, and the source code dependencies can only point inwards. If in a large team SOC between features is well provided, each squad can work exclusively on one or more features without affecting the work of other squads. Below you can see RIB features or products in the app like uber driver.

State Handling

As mentioned above, Ride-hailing apps have many states, so another reason to create RIB by uber is state-handling. There are three commons ways for handling states.

  1. HFSM (Hierarchical Finite State Machine)
  2. FSM (Finite State Machine)
  3. BT (Bahavior Trees)


Base on Wikipedia, HFSM or FSM is A finite-state machine, or simply a state machine is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number of states at any given time. The HFSM, FSM can change from one state to another in response to some inputs; the change from one state to another is called a transition. The only difference between HFSM and FSM is that HFSM reduces transactions by separating two or more states into a group of states. HFSM and FSM have many disadvantages, which you can see below.

  1. FSM : N States. so N * N possible transactions
    every state can transition to another states with no limitation.
  2. Maintainbility
    when adding or removing a state, it is necessary to change the conditions of all other states that have transition to the new or old one. Big changes are more susceptible to errors that may pass unnoticed.
  3. Scalability
    FSMs with many states lose the advantage of graphical readability, becoming a nightmare of boxes and arrows.
  4. Reusablity
    as the conditions are inside the states, the coupling between the states is strong, being practically impossible to use the same behavior in multiple projects.

BT (Bahavior Trees)


Based on Wikipedia, BT is A behavior tree that is a mathematical model of plan execution. They describe switchings between a finite set of tasks in a modular fashion. Their strength comes from their ability to create very complex tasks composed of simple tasks without worrying about how the simple tasks are implemented. Below you can see the advantages and disadvantages of BT.


  1. SOC
  2. Reactivity
    Behavior Trees use the concept of Tick(events), a signal that is sent in a fixed frequency, which starts from the root node and is propagated to its children. By doing this Behavior Trees can react in real-time to events that happen in the world.
  3. Maintainbility
    transitions in BT are defined by the structure, not by conditions inside the states. Because of this, nodes can be designed independent from each other, thus, when adding or removing new nodes (or even subtrees) in a small part of the tree, it is not necessary to change other parts of the model
  4. Scalability
    when a BT have many nodes, it can be decomposed into small sub-trees saving the readability of the graphical model
  5. Reusablity
    due to the independence of nodes in BT, the subtrees are also independent. This allows the reuse of nodes or subtrees among other trees or projects.


  1. Always start from root node
  2. This isn’t a very efficient way to do things, especially when the behavior tree gets deeper as its developed and expanded during development

As you may guess, uber uses BT in RIB architecture. The app is divided into different RIBs (units) and forms a BT tree.

Deep Scope Hierarchies

One of the significant advantages of RIBs is the Deep Scope Hierarchies. In this structure, each unit has its unique scope and, through that scope, can give a series of dependencies to its children. Dagger2 handles these dependencies and scopes.


Deep scope hierarchies enable applications like our rider app, with its feature-dense screens and shared objects between subscreens, to increase separation of concerns, reduce possibilities for stale data, and increase developer velocity.

Cross platform

RIBs present similar development patterns for Android and iOS. By using RIBs, engineers across both iOS and Android platforms can share a single, co-designed architecture for their features.


Adopting non-trivial architectural patterns does not scale beyond small applications without robust tooling. RIBs come with IDE tooling around code generation, static analysis, and runtime integrations. All of which improve developer productivity for large and small teams. Below you can see open source tools.

  1. Code Generation for Android Studio
  2. NPE Static analytis for android
  3. Autodispose static analytics for android

RIB disadvantages

Like other tools, RIB has disadvantages; here, you can read more about RIB’s weaknesses.


My Experience with RIBs and RIBs based architectures
Driver app RIBs architecture
RIB documentation
Rewrite uber driver app
Stanford University : HFSM vs BT

Senior Android Engineer at