Migrating off Roboguice 3 — Part 1

Back Story

At Australia Post we use Roboguice 3 in our main app and after the announcement of Roboguice’s retirement in August 2016, we started looking for a suitable replacement. Five years ago, Roboguice was the number one dependency injection framework on Android, however technology is constantly changing and now there are better solutions available.

I started working on a greenfield project in November 2016 and we decided to choose Dagger 2 as the dependency injection framework. At the time, it was the best option as it was supported by Google and was very popular in the community. I did not have much experience with Dagger 2 but the more I used it, the more I wondered if we had made the right decision (which is another topic for a later article). I had also heard of a few issues about Dagger 2 from friends and other developers in the community and now I was starting to see why. Although I do not have any major issues with Dagger 2 (we still use it on our other app) I wanted to find a framework that was as easy to use like Roboguice 3 but still performed well.

In December 2016, I attended the AndevCon in San Francisco and stumbled upon a talk about ‘Toothpick: A Fresh Approach to DI’ by Stephanen Nicolas and Daniel Lemures from Groupon. Daniel joked about how he tried to learn Dagger 2 from their wiki but instead ended up being an expert in making coffees. They explained how they designed Toothpick to be fast and easy to use. They also explained some advanced features where scopes could be used for workflows and presenters to solve particular Android issues such as rotation and resource management. I had been searching for a simple solution for these problems for a long time and here they were.

After the talk, I spoke directly to Stephanen and Daniel to find out more. They shared with me how it only took them only three weeks to replace their old dependancy injection framework on the Groupon app. The turnaround was short and I wanted to sell the benefits and business value to my own product team back home.

Excitedly, I returned to Australia and wanted to apply what I learnt from the conference to a real world problem that we had encountered with our app. I knew I had to conduct my own due diligence on Toothpick before we could start the migration from Roboguice 3. We had created an app template to bootstrap our android development that used Dagger 2 and I thought if I could successfully convert the template then that would be proof that it worked.

At the time, I was leading two projects at work and I did not have much spare time to work on the conversion. I was determined to get it started and the only spare time I could find was on my 45 minute train ride home. After three train rides home and correspondences with Stephanen, I was confident that Toothpick would work and I started planning the migration off Roboguice on our main app.

To be continued … Part 2