GSoC 2020: New Widget Framework for ODK Collect

GSoC 2020 with Open Data Kit

I have always loved contributing to ODK Collect. Initially, I was involved in minor bug fixes. Contributing to ODK Collect honed my skill set, and made me a better developer.

This summer I was fortunate enough to be selected as a GSoC participant with Open Data Kit. It was a valuable and enriching experience. In this post, I would like to summarize all the milestones completed, recall my failures and learning, and highlight the work to be done in the future.

Useful Links:

Project Repository: https://github.com/getodk/collect
Google Summer of Code Proposal: https://docs.google.com/document/d/1b-HajUECutSBMLjIvPw9iTafypVjJ8KvxUzMHGnr8es/edit
GSoC Project: GSoC: Rewrite ODK Collect's widgets using the new "widget framework" - #6 by Saumia

Project:

Open Data Kit Collect is an Open Source Android Application, available on Google Play Store, that is responsible for rendering different widgets (docs) on ODK-X forms.

The project focuses on reworking the widgets using the new widget framework (defined here). There were two aspects of the project: first, rewriting and potentially expanding the unit test framework and updating the widget structure, which involves shifting as much UI code as possible to XML files, rather than in Java. Once a proper and well-tested framework is entrenched, we can work on improving the UI of the widgets, following the style guide and Material Design (docs).

PR (Merged):

Rework Geopoint Widget and add testing (#3877)
Rework URL Widget and add testing (#3831)
Migrate all Collect Preferences to modern androidx library (#3923)
New Experimental Material Theme Improvements (#3851, #3858 and #3993)
Retain Dialogs on Screen Rotation (#3782, #3786, #3792, #3824, #3839 and #3843)

PR (Approved):

Remove Answer TextView in URL Widget and add Firebase Analytics (#4025)
Rework Bearing Widget and add testing (#4042)
Rework Barcode Widget and add testing (#4032)
Rework Audio Widget and add testing (#4006)
Rework Date and Time Widgets and add testing and use ViewModel for passing data (#3975)
Rework Range Widget and add testing (#3969)
Rework Rating Widget and add testing (#3937)

PR (Ready for Review):

Rework OSM Widget and add testing (#4033)
Rework File Widgets and add testing (#4015)
Use ViewModel for passing data in Range Picker Widget (#3995)
Rework GeoWidgets and add testing (#3922)

Future Work:

  • Complete my ongoing work on restructuring other File Widgets
  • Restructure String Widgets and Item Widgets
  • Carrying out proposed UI modifications to widgets, after proper discussions
  • Remain an active contributor in further refactoring of widgets and implementing MVVM architecture for transfer of data

Challenges Faced:

It was my first time working with such a huge code base with intermittent hierarchies in widgets layouts. Many times, when I tried to refactor things, it would cause some other thing to break unrelated to my work. I faced such breakage while pulling the widgets from the hierarchy and removing the abstract classes. All thanks to Callum, my primary mentor, who was very patient and helping throughout the program.

Lessons Learned:

Some general advice that I will try to follow in the future while writing/refactoring code:

  • Assign proper names to methods and objects, which highlights their specific behavior
  • Write readable and maintainable code, that can be easily understood by someone new in the community.
  • Try to communicate your plans/ideas as much as possible with the community

Conclusion:

It was my first-time experience working as a TDD/BDD style developer. I really enjoyed my contributions as part of GSoC and also the TDD exercise, a collaborative learning assignment, which my mentor came up with, to formulate my thinking into writing tests first without thinking about the actual implementation of things, using ping-pong pairing. Callum has been an exceptional mentor. I learned the importance of good coding practices, learned how to write meaningful unit tests using powerful frameworks, and delved deeper into the latest Android framework. I plan on continuing my contributions to the organization by working on open issues and remaining active in the community.

I would like to thank @seadowg, @ln, @Grzesiek2010, and all other members of the ODK community.

4 Likes