Software Dev

The what, why, and how of the RIBs mobile architecture

Continuing my mobile architecture kick, let’s look next at RIBs. In this case, RIBs is not a delicious, slow-cooked entrée but rather a software architecture that Uber developed a few years ago.

Why RIBs?

RIBs lets Uber’s 200+ mobile developers knock out features quickly without stomping all over each other.

The original design worked well for the first three developers. (via Uber)

Back in 2016, the Uber team had just expanded from three mobile developers several hundred developers. And the app’s design did not scale well to that large of a team. From both a UX/design perspective and a technical perspective, it became difficult to add features. Citing “quite a few examples of, you know, pretty bad UI”, the design team bravely demanded a rewrite.

The design team came in and said, you know, ‘We probity have to redesign the whole application.’… Everybody was super concerned.

Classic engineering understatement

The Uber engineering team resisted the rewrite (which can be nightmare for a large app) for a year, but eventually came around to its necessity. So they defined a few goals for the new design (99.99% reliability, scaling to ~1000 developers, …) and experimented with that they knew – MVC, MVVM, MVP, and VIPER.

But nothing worked. 🤦🏻‍♂️

The problem is that all these architectures are based around the view, and if you base everything around the view, everybody has to integrate at one point, and that becomes a mess at the scale that we have.

The state tree solution

So they came up with a fresh idea, which was to model the whole app as a state tree. Much to their surprise, it worked really well. 🤷🏻‍♂️

We haven’t found an application that you couldn’t model with this very nicely.

A special architecture subteam spent six months reworking some “super ugly looking” core use cases and then turned the rest of the team loose on the new architecture.

Now we have RIBs and the modern Uber app.

Whoa! That looks too easy! (via Uber)

But how does it work?

A RIB is a combination of Router/Interactor/Builder (plus Presenter/View, but I guess “RIBPV” doesn’t sound very good). Each RIB represents a state of the app, which can have sub-states as children.

For example, the root of the tree has two children: logged-out and logged-in. Every RIB under logged-in can safely assume that the user is logged in, and it has an authenticated user token 🔑 to prove it.

RIBs can present themselves hierarchically on top of each other on the screen. Some RIBs just do background support don’t show themselves at all.

No auth token for you, left side. (via Uber)

For more…

Pretty cool, eh?

Okay, I’ll stop here since this is a conceptual overview (aka a teaser) and not a tutorial. ✋ For more details, see the original Uber presentation below or try it yourself.

Up next in the architectural series, we’ll attack The Composable Architecture, which is responsible for at least one cool game and, like RIBS, has a concrete implementation rather than just a bunch of vague ideas. 🙏

Software Dev

Scaling up: how AirBnB ships a quality, gigantic app

AirBnB’s iPhone app has a gigantic code base (1.5 million lines of first-party code), a giant mobile team (75 iOS engineers), and a long history (first commit: 2010).

Over time, their app got so big and complex that the project began to take minutes to open (not build) in Xcode. Developers had to use the USB port on the right side of their MacBooks to avoid thermal throttling. 🤦🏻‍♂️

Given all this sheer complexity, the team there made some clever adjustments to develop, test, and ship their app pretty efficiently. Check it out.

👉 Designing for Productivity in a Large-Scale iOS Application

Among the highlights are independent modules called Dev Apps.

A Dev App allows a product developer to iterate on their feature’s UI and much of its business logic while building a fraction of the overall Airbnb application.

Dev App for an existing Airbnb module

For dependencies across modules, module types allow for “visibility rules” to minimize and document dependencies.

Also, AirBnB uses the Buck build system to keep Xcode projects out of source control (bye bye, Xcode project merge conflicts).

via iOS Dev Weekly.

Software Dev

Mobile Native Foundation: Developing Large-Scale Apps

Writing apps for a large organization has its own unique challenges.

Large teams require that you collaborate in complex ways while keeping quality and delivery speed high. It’s not straightforward, and it makes the days of knocking out an app on your own look fun and easy, if somewhat solitary.

@MobileNativeFoundation

It’s not just about “data structures and algorithms” or any of that Computer Science 101 stuff at this level.

The Mobile Native Foundation is a new organization that focuses on large-scale app development issues for iOS and Android.

It’s mostly just discussion groups right now, but they have contributions from people at large companies with apps you know and respect such as Lyft and Spotify.

The discussions cover relevant topics ranging from organizational (such as Encouraging and enforcing testing), to design (Building Modern UI), to technical (Splitting an app into modules).

👉 This site also reminds me of a book on large-scale app development that I’m currently working through: Building Mobile Apps at Scale.

Via iOS Dev Weekly.

Software Dev

The Elm Architecture

I’ve been trying to understand the Elm Architecture for a new iOS project. I kept reading over this article and thinking, “Wait a minute…. What’s the catch here? This seems too simple.” 🧐

👉 The Elm Architecture: Simple, yet powerful – An overview by example

I like that this architecture can be explained in a very short post with examples.

The beauty of The Elm Architecture lies in its simplicity.

That article is simple but assumes a web UI and explicit mentions HTML 🙄. Here is a funnier and more useful article about Elm for iOS. 😂

👉 Elm architecture in iOS: Why you don’t need shit like RxSwift or MVVM

Elm architecture can be described as follows

msg -> Model -> View -> msg

I even made my own diagram just to make sure I “got” it. The devil is in the details, but I think this is right. 🤷🏻‍♂️ It definitely seems simpler than VIPER.

Software Dev

What Adding Dependencies Will Do To Your App in 2020

I like the title of this article because it recognizes that pulling third-party dependencies into your app has a cost.

👉 What Adding Dependencies Will Do To Your App in 2020

And yet we all do it because it also has its benefits. 🤦🏻‍♂️😂

That article is a realistic and practical look how the dependencies affect your app in terms of app launch times, app size, and build times. It compares Swift Package Manager 🤓, Carthage 🤷🏻‍♂️, CocoaPods 😬, manual dependency management 🥺, and Git Submodules 🤮.

I still have a dream of zero dependencies 🤩, but I know it’s not realistic in a complex app. 😑

Via iOS Dev Weekly.

Software Dev

Reducing Your App’s Memory Footprint

Retain cycles, timers, big images, caching. These are a few reasons why your app might be using more memory than it should.

It might be a good time to audit your app and see how much memory it’s really using.

Lazy loading, implementing memory warning methods, using NSCache, autorelease pools. These are a few ways to deal with it.

Also, let’s say, just make a clean, focused software design. 🤷🏻‍♂️

👉 How To Reduce Your App’s Memory Footprint

Software Dev

iOS Development Class at Stanford 🎓

It’s looking easier than ever to learn from Stanford University. The Computer Science department has posted their latest class on Developing Apps for iOS online. 🤯.

It’s free. It has lecture videos, handouts, and assignments. As far as I can tell, you get everything but grades and a diploma. 🤷🏻‍♂️. But feel free to make an app!

👉 CS193p – Developing Apps for iOS at Stanford

It currently covers SwiftUI, MVVM and the Swift Type System, Reactive UI Protocols Layout, and Grid enum Optionals.