-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Tech-improvement: Refactor high-complexity classes #888
Comments
As part of #1092, we are looking to introduce a consistent pattern for our backend codebase. The same consistency should be followed for our presentation layer. There are several architectures out there and some of the most popular ones are MVP and MVVM. We already use MVP for our uploads flow and also for displaying campaigns(thanks to @ashishkumar468). Am adding linkings to a few insightful blog posts which talk about how and why to use MVP in android.
IMO, our app would benefit from following a standard architectural pattern for its presentation layer mainly because it would provide a clear understanding of structuring code and avoiding code smells to all contributors. Some of the anti-patterns that I observe and hope to fix as a team is:
|
There seems to be a bit of a duplicate here. I was intending for #1092 to be the main issue for this task, with #1863 for reference. Shall I close this issue and move your comment over to #1092 , @maskaravivek ? |
Yes I agree #1092 should be the main issue but it might get messy to have all the discussion on that thread. I thought it would be easier to follow the discussion if we have separate issues for mediawiki apis(retrofit and okhttp), shared prefs, presentation layer, content providers etc, keeping #1092 as the parent issue. Edit: If you intend to keep the discussion at one place, feel free to close this issue and we can continue the discussion on #1092. We can probably crease separate issues while actually implementing the changes. :) |
Sorry for the delay in response, @maskaravivek . I just went through the articles on MVP and it looks good to me - I especially like that it benefits testability and reusability. :) I would be on board with using this architecture for our backend overhaul. If anyone disagrees or would like to propose a different one, now is the time to speak! ;) The official announcements for approved grants will be out in a week's time, and Vivek has requested to start on this task ahead of time if possible. |
I agree with @misaochan on the benefits. Even my vote goes for MVP. |
As there are no contradicting opinions, we will be going with MVP. :) In order to maintain consistency in our codebase, we are thinking of requiring that all new PRs created after a certain date should adhere to this architecture, as well. This would apply to all volunteers, interns, and grantees - since there is no purpose in doing this overhaul if we are not going to maintain its consistency. Of course, by its very nature, this is unlikely to affect bugfixes and very small enhancements (for instance, if you just fix a NPE, we are not going to expect that you will refactor all the code surrounding it) - it is only larger changes and large enhancements that would be affected. If no one has issues with this, I will create the rule for all PRs created after 18th March, and update our wiki. This may also tie in with new contribution guidelines if we reach a consensus at #2553 |
Added a rule to our wiki for this: https://github.com/commons-app/apps-android-commons/wiki/Code-style |
Address the very high cyclomatic complexity we are seeing from Codacy by breaking up Activities & Fragments according to one of the well-respected architectural patterns (MVP / MVVM / etc)
The text was updated successfully, but these errors were encountered: