Technical Architecture of the Quora Android App: Optimized for Speed and Efficiency

Technical Architecture of the Quora Android App: Optimized for Speed and Efficiency

Quora, the renowned question-and-answer platform, has made significant strides in creating an optimal user experience across various devices. This article delves into the technical architecture of the Quora Android app, detailing the key components and decisions that contribute to its performance and seamless functionality.

Overview

The Quora Android app, like its iPhone counterpart, was designed from the ground up with the goal of providing the best possible user experience on Android devices. The app's architecture is a blend of native views, optimized webviews, and an API layer, all managed to ensure efficient communication and timely updates. Push notifications via GCM (Google Cloud Messaging, now Firebase Cloud Messaging) and background data fetches enhance the real-time experience while being mindful of battery life.

Maintaining a Single Code Base

To maintain a single code base for Android and iPhone, the team made strategic decisions where possible. This approach minimizes code duplication and simplifies updates and maintenance. For native code, separate code bases are necessary due to platform-specific requirements. The API and webnode2 HTML5 generation code share a common mobile app code base, with per-platform or device-specific abstractions. In the optimized mobile JavaScript, conditional statements are used to handle platform and version differences. CSS also follows a base mobile style with device-specific overrides.

Addressing Webview Differences

Webviews on different Android versions and compared to iPhones present unique challenges. To address these, Quora developed an Android-specific JavaScript support library that includes fast tap events, HTML5 input element support, and silent refreshing of parts of the view. The native counterpart further enhances the webview experience across supported versions, supporting core functionalities such as saving and restoring the view, handling more response input events, and managing crash edge cases. This also involves dealing with manufacturer and vendor tweaks, addressing various interaction and view issues in the webview.

Utilizing Standard Libraries and Custom Solutions

The app's architecture relies heavily on standard libraries, with custom libraries used only when necessary and based on platform-specific standards. Supporting Android versions from 2.2 to 4.1, spanning six SDK releases, is a significant challenge. A specialized library was particularly helpful in porting core style conventions and standard widgets. In several cases, custom view components were developed based on standard views, such as lists with headers and expandable sections, inspired by iOS features like pull to refresh and a text editor.

Fragment-Based Layouts for Navigation

To manage the complex navigation between the app's 50 unique screens, the developers used fragments and the compatibility library instead of activities. This approach ensures better memory management, as fragments are saved and destroyed when pushed onto another fragment. Fragments also initialize faster on certain devices, resulting in snappier transitions. This layout strategy is particularly useful for anticipated tablet support, as internal prototypes explored different layouts such as placing views next to each other on the same screen. The bundled view logic within fragments simplifies implementation for new screens.

Optimizing for Speed

Speed is a paramount concern for Quora, and the team has made extensive efforts to write fast and stable abstractions that benefit the entire app. This optimization makes it easier to implement new screens and enhances the overall user experience. By focusing on these core components, Quora has been able to create an app that is both user-friendly and highly performant.