Home » Android » android – Transfuse vs AndroidAnnotations

android – Transfuse vs AndroidAnnotations

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’d like to know if there’s anyone using Transfuse and how it differs from Android Annotations. I mean the pros and cons of each one, and if there are other options besides these two.

Thanks.

How to&Answers:

I may not count because I wrote the library, but I am an active user of Transfuse 🙂

Here’s the comparison from Transfuse’s point of view:

Transfuse and Android Annotations share the same goal of reducing boilerplate and complexity in Android. Both Transfuse and Android Annotations are extremely performant as they use nearly identical techniques for generating code at compile time. In fact AA was one of many inspirations for Transfuse.

Android Annotations battles boilerplate by introducing code in the class extensions associated with the annotated classes. You can find the introduced code in the Class_ files in the generated source. Android Annotations includes a variety of features including a light dependency injection mechanism, a REST client generator, and a variety of Activity/Context enhancements among others.

Transfuse, on the other hand, approaches this goal through Dependency Injection, POJO components and Manifest Management among other ideas borrowed from Enterprise Java libraries. For instance, Transfuse Activities don’t extend android.app.Activity. Instead you add functionality to your Activities via the annotations, which Transfuse uses to wire up the resulting generated code. Transfuse is also JSR330 compliant, which means it is a fully featured IOC/DI engine comparable with Guice (Roboguice) or Dagger. This gives the developer a lot of functionality to wire up object graphs behind the application without having to maintain the resulting code. Finally, one my my favorite features, Transfuse manages the writing of the AndroidManifest.xml file for you, so you don’t have to remember to register your components. This is a huge time saver, especially when starting a new application.

I am asked this comparison question a fair amount, or how it compares with RoboGuice and Dagger. I should probably put together a comparison matrix to highlight the significant differences between the libraries.