Search code examples
android-annotations

Android Annotations - is this a good practice?


I am a beginner android developer (developing for 1.5 years).
Through this period my main sources of studies were
www.developer.android.com and google trainings on Udacity.
Recently I received a project for refactoring, which was created by a Senior developer with the deep using of Android Annotations and I was a little frustrated during refactoring of that code. As this code looks a lot different from what I learned before.
Then I implemented Android Annotations in a few projects and surprised how handy it is when dealing with REST services, separating background and UI tasks etc.
So the question is:

  1. Is this a good practice to use Android Annotations in terms of code style conventions and in other terms?
  2. When (in which projects) should I use them and when shouldn’t?

Solution

  • 1 - IMHO with AA you can remove a lot of boilerplate code, makes your code much more readable, improve the maintainability by the same time do not degrade runtime performance.

    2 - You can always use Android Annotations in your projects, and it`s not a problem, you just need to pay attention with how the annotations that you use works under the hood.

    --- UPDATE --- 26/10/2017

    You should pay attention about code unit tests, because AA has a static injection, and this makes impossible to change the implementation of a component in runtime. Nowadays i do NOT recommend to use AA.