Aware structure: Headspace’s refactor to scale

Posted by Manuel Vicente Vivo, Android Developer Relations Engineer

Contributors: Mauricio Vergara, Product Advertising and marketing Supervisor, Developer Advertising and marketing, Marialaura Garcia, Affiliate Product Advertising and marketing Supervisor, Developer Advertising and marketing

Headspace Technical case study graphic

Govt Abstract

Headspace was able to launch new wellness and health options, however their app structure wasn’t. They spent eight months refactoring to a Mannequin-View-ViewModel structure, rewriting in Kotlin and bettering take a look at protection from 15 to 80%. The improved app expertise elevated MAU by 15% and elevated assessment scores from 3.5 to 4.7 between Q2 and This autumn of 2020. To be taught extra about how Headspace’s give attention to Android Excellence impacted their enterprise, learn the accompanying case examine here.


Headspace has grown into a pacesetter in mindfulness by creating an app which helps tens of millions of individuals to meditate each day. Mindfulness goes far past meditation, it connects to all points of an individual’s life. That concept prompted the newest stage in Headspace’s evolution. In 2019, they determined to develop past meditation and add new health and wellness options to their Android app. Headspace realized that they would wish a cross-functional workforce of engineers and designers to have the ability to ship on the brand new product imaginative and prescient and create an excellent app experience for users. An thrilling new section for the corporate: their design workforce began the method by creating prototypes for the brand new expertise, with recent new designs.

With designs in hand, the one factor stopping Headspace from increasing their app and broadening customers’ horizons was their current Android software program structure. It wasn’t effectively structured to assist all these new options. Headspace’s growth workforce made the case to their management that constructing on the prevailing code would take longer than an entire rewrite. After sharing the imaginative and prescient and getting everybody on board, the workforce set out on a collective journey to jot down a brand new Android app in pursuit of app excellence.

The Android Rewrite

Headspace’s Android growth workforce first wanted a handy technique to standardize how they constructed and applied options. “Earlier than we wrote a single line of code, our workforce spent per week evaluating some vital implementation selections for the muse of our app,” Aram Sheroyan, an Android developer at Headspace explains;

“This was essential pre-work in order that we have been all on the identical web page once we truly began to construct.”

Immersing themselves in Google’s literature on the most recent, greatest practices for Android growth and app architecture, the workforce discovered an answer they might all confidently agree on. Google advisable refactoring their app utilizing a brand new base structure: model-view-view-model. MVVM is a widely-supported software program sample that’s progressively turning into business commonplace as a result of it permits builders to create a transparent separation of issues, serving to streamline an app’s structure. “It allowed us to properly separate our view logic,” Sheroyan defined.

With MVVM as the bottom structure, they recognized Android’s Jetpack libraries, together with Dagger and Hilt for dependency injection. The brand new instruments made boilerplate code smaller and simpler to construction, to not point out extra predictable and environment friendly. Mixed with MVVM, the libraries supplied them with a extra detailed understanding of how new options ought to be applied. The workforce was additionally capable of enhance high quality in passing arguments between capabilities. The app had beforehand suffered from crashes resulting from NullPointerException errors and incorrect arguments. Adopting the safeArgs library helped to eradicate errors when passing arguments.

In rewriting the app, the workforce additional made positive to comply with the Repository sample to assist a clearer separation of issues. For instance, as an alternative of getting one large class that saves knowledge in shared preferences, they determined that every repository’s native knowledge supply ought to deal with the respective logic. This separation of knowledge sources permits the workforce to check and reproduce enterprise code exterior of the dwell app for unit testing with out having to alter manufacturing code. Separating issues on this approach made the app extra secure and the code extra modular.

The workforce additionally took the chance to completely translate their app into the Kotlin programming language, which provided helpful helper capabilities, sealed lessons, and extension capabilities. Eradicating legacy code and changing the combo of Java and Kotlin with pure Kotlin code decreased construct time for the app. The brand new structure additionally made it simpler to jot down checks and allowed them to extend take a look at protection from round 15% to greater than 80%. This resulted in quicker deployments, larger high quality code, and fewer crashes.

To seize the brand new consumer expertise within the app’s critiques, Headspace applied the Google Play In-App Review API. The brand new API allowed them to encourage all customers to share critiques from inside the app. The implementation elevated assessment scores by 24%, and — as retailer itemizing critiques are tied to visibility on Google Play — helped draw consideration to the app’s current enhancements.

Attaining App Excellence

The rewrite took eight months and with it got here a brand new confidence within the code. Now that the codebase had 80%+ unit take a look at protection, they might develop and take a look at new options with confidence moderately than worries. The brand new structure made this attainable because of its improved logic separation, and a extra reusable code, making it simpler to plan and implement new options.

The construct time for the app decreased dramatically and growth velocity picked up. The workforce’s new readability round greatest practices and structure additionally lowered friction for onboarding new builders, because it was now based mostly on Android business requirements. They may talk extra clearly with potential candidates through the interview course of, as they now had a shared architectural language for discussing drawback units and potential options.

With velocity got here quicker implementation of options and an improved retention circulation. They may now optimize their upsell course of, which led to a 20% enhance within the variety of paid Android subscribers relative to different platforms the place the app is revealed. The mix of a brand new app expertise and the implementation of the brand new In-App Evaluate API led to their assessment scores bettering from 3.5 to 4.7 stars between Q2 and This autumn of 2020! General, the brand new give attention to Android App Excellence and the improved rankings earned Headspace a 15% enhance in MAU globally..

These have been just some of the payoffs from the numerous funding Headspace made in app excellence. Their laser give attention to high quality paid off throughout the board, enabling them to proceed to develop their group of customers and lay a strong basis for the longer term evolution of their app expertise.

Get your individual workforce on board

For those who’re serious about getting your workforce on board in your personal App Excellence journey, take a look at our condensed case examine for product homeowners and executives linked here. To be taught extra about how constant, intuitive app consumer experiences can develop what you are promoting, go to the App Excellence touchdown web page.

Recent Articles

Fb Whistleblower Says She Invested in Crypto on the Proper Time

Fb's former product supervisor turned whistleblower Frances Haugen has revealed that her refuge in Puerto Rico is "fantastic for the foreseeable future" due...

These are the most effective circumstances for the Amazon Hearth HD 10

Finest Amazon Hearth HD 10 & 10 Plus circumstances Android Central 2021 Whereas Amazon Fire Tablets aren't the costliest tablets round, they are not low cost both. So...

greatest puzzle journey video games

For correct use of this web site, you might want to allow javascript in your browser! Finest Level &...

Related Stories

Stay on op - Ge the daily news in your inbox