Google Summer of Code, also known as GSoC, is an initiative by Google for encouraging student developers to contribute to Open Source Software. For its 2020 edition, I proposed to work with The Mifos Initiative which is a fin-tech organization, aimed at providing technology-enabled financial inclusion to those who are underbanked all around the world.
I spent the summer working with mifos-mobile - a customer facing mobile application built on top of MifosX which enables the customer to access their bank account using their smartphone. The app was built using Java. I converted the app to Kotlin, so as to enjoy the benefits that Kotlin offers over Java, and enable cross-platform development in the future using Kotlin multi-platform.
Kotlin is a powerful language and using Kotlin for Mifos Mobile has the same reasons as to why nearly all android developers prefer Kotlin over Java.
- Modern: Kotlin is a new language that has adapted and corrected mistakes over the time. It is also a very concise language and that would be very obvious after you start using it. A quick example for that is - No more semi-colons!
- Interoperable: Kotlin generates the same bytecode as what Java does. So Kotlin can seamlessly call Java code and vice-versa. So developing using Kotlin on top of a Java project is an easy thing.
- No Null Pointer Exceptions: Null type is integrated into the language's type system itself. So it is not necessary to keep wrapping codes with null checks around it to avoid NPE, the billion dollar mistake
- Multi platform: Kotlin is not limited just for android development. Kotlin Native opens possibilities for Kotlin to support almost any platform. This is also among the main reasons for Mifos Mobile to adopt Kotlin, so that the app will soon support iOS development in the same codebase.
-
- Depended on Kotlin
kapt
instead ofannotationProcessor
and implementedannotationLibrary
from android Jetpack library to support annotations post converting the app to Kotlin. - Converted authentication method to support the new authentication method used by the fineract backend where the user's credentials are passed in the API request's JSON body. Rewrote tests to support the new authentication method too.
- Converted Login activity to Kotlin
- Depended on Kotlin
-
-
Converted the following classes which were previously in Java to Kotlin, which translates to converting the app completely to Kotlin.
- Passcode activity
- Constants
- Convert Registration activity
- Home activity and fragments
- Base activity and fragments
- API related classes
- All View classes
- All classes under
/main/../ui
(Activities, Adapters, Enums, Views, Widgets, Fragments) - All Adapter classes
- All Presenter classes
- All JUnit tests
- All activity classes
- All model classes
- All Injection classes
MifosSelfService
classcommonTest
andandroidTest
classes
-
-
- Compiled and organized all the APIs consumed by Mifos mobile and organized in a google sheet for future reference
-
- Formed the basic structure for compiling the app to target both iOS and android using Kotlin multi platform
- Implemented a simple screen on iOS which displays the name of the app and version of iOS it is running on, to demonstrate the common code functionality offerred by Kotlin multi-platform
- Created a POC wiki page to help developers get started with working on the app with mutli-platform
- Used Espresso from the jetpack library to write UI tests for the app, instead of having to manually test the app everytime
- Used
CountingIdlingResource
instead of sleeping the thread to improve the reliability of testing to handle async tasks (Login API request) - Currently automated tests for Complete login flow and all buttons in the Home activity
-
- The Jetpack library offers a robust alternative to ButterKnife, which is View Binding. There are some advantages like
- No more
@BindView
annotations, drastically reduces boilerplate code. - Type safety and Null Safety inbuilt
- No
@OnClick
annotations required
- No more
- The Jetpack library offers a robust alternative to ButterKnife, which is View Binding. There are some advantages like
-
ProgressDialog
was depreceated in Java and all instances of the same in the app can be converted toprogressBar
-
- There might be a few variables which still remain non-nullable post conversion from Java and also some class properties which doesn't enjoy Kotlin's inline initialization and uses an
init{}
block instead. Those instances can be converted to fully support Kotlin's features.
- There might be a few variables which still remain non-nullable post conversion from Java and also some class properties which doesn't enjoy Kotlin's inline initialization and uses an
-
- The app has a whole lot of screens without UI test implemented. The same can be written with the help of Espresso library
- Can organize the Espresso UI tests into a JUnit test suite for easier test navigation
Big thanks to my primary mentor Saksham Handu, for constantly guiding me throughout the working period and helping me amidst his busy schedule and org admin & CEO of Mifos Ed Cable for helping the class of interns to communicate with the organization and getting our blockers resolved. Thanks to all the fellow developers who helped each other whenever needed.