Android Builders Weblog: Aware structure: Headspace’s refactor to scale

Posted by Manuel Vicente Vivo, Android Developer Relations Engineer

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

Headspace Technical case study graphic

Government 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 enhancing check protection from 15 to 80%. The improved app expertise elevated MAU by 15% and elevated evaluation scores from 3.5 to 4.7 between Q2 and This fall of 2020. To study extra about how Headspace’s concentrate on Android Excellence impacted their enterprise, learn the accompanying case research here.


Headspace has grown into a frontrunner in mindfulness by creating an app which helps hundreds of thousands of individuals to meditate each day. Mindfulness goes far past meditation, it connects to all elements of an individual’s life. That concept prompted the latest stage in Headspace’s evolution. In 2019, they determined to increase 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 part for the corporate: their design workforce began the method by creating prototypes for the brand new expertise, with contemporary new designs.

With designs in hand, the one factor stopping Headspace from increasing their app and broadening customers’ horizons was their present Android software program structure. It wasn’t properly structured to assist all these new options. Headspace’s growth workforce made the case to their management that constructing on the present 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 write down a brand new Android app in pursuit of app excellence.

The Android Rewrite

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

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

Immersing themselves in Google’s literature on the most recent, finest practices for Android growth and app architecture, the workforce discovered an answer they might all confidently agree on. Google really helpful refactoring their app utilizing a brand new base structure: model-view-view-model. MVVM is a widely-supported software program sample that’s progressively changing into business customary 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 offered them with a extra detailed understanding of how new options must be applied. The workforce was additionally capable of enhance high quality in passing arguments between features. The app had beforehand suffered from crashes as a result of NullPointerException errors and incorrect arguments. Adopting the safeArgs library helped to remove 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 information sources permits the workforce to check and reproduce enterprise code outdoors 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 features, sealed lessons, and extension features. 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 write down checks and allowed them to extend check protection from round 15% to greater than 80%. This resulted in quicker deployments, greater high quality code, and fewer crashes.

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

Reaching 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 check protection, they might develop and check new options with confidence moderately than worries. The brand new structure made this doable 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 finest practices and structure additionally decreased friction for onboarding new builders, because it was now based mostly on Android business requirements. They might talk extra clearly with potential candidates throughout 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 might 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 mixture of a brand new app expertise and the implementation of the brand new In-App Evaluation API led to their evaluation scores enhancing from 3.5 to 4.7 stars between Q2 and This fall of 2020! General, the brand new concentrate on Android App Excellence and the improved scores earned Headspace a 15% enhance in MAU globally..

These had been only a few of the payoffs from the numerous funding Headspace made in app excellence. Their laser concentrate on high quality paid off throughout the board, enabling them to proceed to develop their group of customers and lay a strong basis for the long run evolution of their app expertise.

Get your individual workforce on board

In the event you’re occupied with getting your workforce on board to your personal App Excellence journey, take a look at our condensed case research for product house owners and executives linked here. To study extra about how constant, intuitive app person experiences can develop what you are promoting, go to the App Excellence touchdown web page.

Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button