Skip to content

Completely overhaul app backend (legacy code) #1092

Closed
@misaochan

Description

@misaochan

Talked to @maskaravivek and @neslihanturan about this today. It feels like a lot of time is wasted trying to understand the legacy code in our app and getting new modifications to work well with it. Much of the time is spent patching up something that no one in our team is really familiar with and that was written more than 4 years ago (a long time in Android development). When I talked to the original developer, he said that he created the app when he was relatively new to Android development as well, so he didn't have an answer for some questions on why things are done the way they are. :)

This will be a very long haul task (and will probably not happen anytime soon), but we are considering allocating a few months in the future (possibly for the next grant) for completely overhauling the app backend. The intention is for it to all be modernized and coherent rather than playing patchwork with legacy code.

If we do this, we should make sure to include Javadocs for each class we create so that future developers don't encounter the same problem.

Thoughts/suggestions? What model/architecture should we adopt if we do this?

Edit:

Copying the current plan for the app overhual(from @misaochan's later comment) to this comment to make it easier to track.

  • Replace all usages of the deprecated org.mediawiki:api library with Retrofit (plus RxAndroid) for network calls, which will also remove our reliance on the outdated yuvi:http.fluent and org.apache.http.legacy libraries. User:DBrant_(WMF) has informed us that the Wikipedia app team are working on packaging their network code into a standalone library that adheres to these best practices and will be usable by other apps, so we will use their library to simplify this implementation once it is ready. (includes Migrate all APIs to retrofit #3026 ) Edit 13 Aug: due to difficulty of maintaining the Wikipedia data client library, we were advised to fork/copy the source code instead of using it directly.
  • Refactor all AsyncTasks to use RxAndroid instead, for consistency
  • We have already implemented a stricter process for including new libraries in pull requests, and we will now go through all our existing dependencies to see if we should keep or remove them, and refactor the code accordingly. Go through all our existing dependencies to see if we should keep or remove them #3128
  • Refactor our content providers to adhere to modern standards, and eliminate hardcoded column positions Refactor our content providers to adhere to modern standards #3127
  • Consolidate our multiple SharedPreferences databases into one
  • Clean up all string literals in code and replace them with string resources, to better take advantage of TranslateWiki translations Clean up all string literals in code and replace them with string resources #3129
  • Overhaul our authentication system, which has been the culprit of several failed upload issues (the issues have been mostly patched up, but still happen occasionally, i.e. the foundations are shaky). We will investigate how the authentication flow can be simplified, and take a look at how we are handling edit tokens (the usual cause of failures). -> Refactor network layer to use OkHttp. Edit 13 Aug: The switch to data client seems to have solved failed uploads in our tests. We will hold off on this until we release v2.12 and get feedback from users, since this may no longer be necessary. If anyone still experiences issues, we will then proceed with this.
  • Ensure thorough test coverage for all overhauled components (for reference, our grant success metric is >25% code coverage)

Module progress:

  • Upload process
  • Network layer / authentication
  • Notifications / achievements
  • Explore / media details
  • Nearby
  • Peer review

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions