Byte-Sized Design

Byte-Sized Design

Why Reusing Code Backfired Uploading Photos on Dropbox

It wasn't cross compatible.

Byte-Sized Design's avatar
Byte-Sized Design
Apr 23, 2023
∙ Paid

TLDR;

Dropbox was using the same C++ code library to upload photos from smartphones. This wasn’t sustainable because Android and IOS started to have different constraints and requirements (ex. when background processes can run).

This led Dropbox to use native platform technologies like Swift (IOS) and Kotlin (Android) to scale uploading photos.

What’s the Problem?

Using the exact same reusable library for photo uploads for both Android and IOS devices is not scalable for Dropbox.

Android recently included AppStandby limits to allocate resources to apps being frequently used. Having a shared C++ library to be aware about differences like these leads to an unmaintainable codebase.

For Dropbox’s use case, silently uploading photos in the background has become more of a problem for Android users like forgetting to upload images when network activity is available.

Give me the Requirements!

Focusing on Android architecture, here’s what we care about

  1. Take advantage of as much background activity as possible.

  2. Photo uploads need to be speedy quick and limit memory usage

  3. Validate and don’t break anything that already works

(IOS architecture isn’t in scope, lets focus on one thing at a time)

What are we doing, boss?

First, we’re uploading photos on Kotlin instead of C++.

For everything else, we’re doing this:

Background Activity:

  1. If a new photo is added or being changed, a background worker called the “Scanner” picks them up and queues them up.

  2. Another worker called the “Uploader” looks at the queue and batch uploads them to Dropbox when there’s network activity available.

Speed and Latency

  1. Upload multiple photos at the same times by fixing endpoints to support this.

  2. Scan the entire library every there’s a change. Process anything that has already been checked, even if scanning is still on-going.

Validation

  1. Run things against the old C++ library and Kotlin implementation at the same time. Compare and if anything’s different, something went wrong.

Simplify the Design!

Keep reading with a 7-day free trial

Subscribe to Byte-Sized Design to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Byte-Sized Design · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture