Android Stack Migration at Boolio
Our new Medium Android app is now released in the wild. We’re proud of it. But we owe a deep debt to the communities…medium.com
“We owe a deep debt to the communities that fashioned the tools that made it possible.” — Medium Engineering, Daniel McCarthy
Here at Boolio, we would also like to extend our gratitude. Our most recent Android release involved a migration to several of the tools listed in the post, including Butter-knife, Retrofit, Glide, and Fabric.
These integrations cut our own source by more than 500 lines, which greatly improves the maintainability of our code base — albeit by outsourcing it to the beautiful open-source communities out there.
From Volley to Retrofit
Switching from Volley to Retrofit contributed to trimming down our code base the most. With Volley for every route, we had a ton of code wrapping a request to our servers.
- We created a custom request handler to take care of logging, handling errors, and parsing success responses.
- For each route we had, we wrote a small wrapper function to take in the request inputs and make the request.
- Once the request comes back, custom callbacks with custom parsers parsed the input into objects for the app to use.
With Retrofit, it all went away.
- Retrofit (together with okhttp) made making requests as simple as a declaring a routing table with @decorators.
- For custom logging and request packaging, Retrofit provided interceptor classes that intercepted incoming and outgoing requests.
- Using its own parser around GSON, Retrofit kindly parsed outgoing and incoming data. Additionally, this placed some nice restrictions on the request and response format our server accepted — this really forced us to clean up and standardize our API.
With every step we take, we will continue to improve the service and experience Boolio has to offer. We are always on the lookout for newer and better technologies, so if you have any suggestions, step right up, and stay tuned!