Building Shopify POS for Android Using MVVM
Article Summary
Richa Khanna from Shopify reveals how their team migrated a 3.5-year-old Android POS app from competing MVC/MVP architectures to MVVM without a full rewrite.
Shopify's Point of Sale Android app faced a common problem: two competing architectures (MVC and MVP) creating codebase inconsistency and onboarding friction. The team adopted Google's MVVM pattern incrementally, writing new screens in MVVM while converting legacy code during major updates.
Key Takeaways
- Incremental migration strategy: new screens in MVVM, convert old screens during updates
- ViewModel survives configuration changes, automatically retaining state across rotations
- Contract interfaces between View and ViewModel enable independent testing
- LiveData respects Android lifecycle, only updating UI in active states
- Consistent architecture reduced onboarding time for new developers
MVVM gave Shopify POS automatic state retention, clearer separation of concerns for easier testing, and a consistent pattern that eliminated architectural confusion across the team.
About This Article
Shopify's POS app had been around for 3.5 years when the team realized it was built on two competing architectures, MVC and MVP. This inconsistency left developers confused about which pattern to follow when building new features.
The team switched to Google's MVVM pattern, using ViewModelProvider and LiveData. They added contract interfaces to separate the View from the ViewModel, which made it possible to test business logic and UI states independently.
MVVM cleared up the architectural confusion. New team members had an easier time getting up to speed because the codebase now had consistent examples to follow. The team could also write screenshot and unit tests more efficiently without needing to create Fragments and Views.