Working with Android legacy code

In this blog, I would like to share my experience of working with Android legacy code which work well for me so far.

First of all, when I get into an Android project which contains legacy code. I will ask about the current situation of the application:

  • Current features
  • Current know issues
  • Current patterns are being used in the projects
  • Current overall structures
  • Current way of working of the team
  • Current parts in which contain legacy code
  • Current UI tests
  • Current Unit tests

Then I spent some times to get familiar with the current features by getting a phone and try out the current features and the known issues and take notes of those things. In my experience, the applications can be complicated that even the ones who develop it don't know all the features and known issues of it. Therefore, taking note and comparing with the transferred knowledge is a good way to start understanding the application. Now, hopefully, I have a good idea of what I am dealing with. Then I run the tests if there are any.

Next, I write UI tests to cover all the features by clicking through the applications and checking the visibility of elements of individual screens. These type of screen tests save the developers a lot of typing time on the mobile phones.

Finally, I will add unit tests gradually to the code base whenever touching a feature which didn't have enough tests.

Some useful commands and files I used: code reviews tools to read through all PRs, string resource files, icon drawable filesgit grep and git blame/Android Studio's annotate.

Please feel free to left me some comments or questions.

- ninjahoahong


Popular posts from this blog

My books review: "The retrospective handbook"

My books review: Money for the rest of us

Use SwiftUI preview with UIKit