Hi everyone. I am Dhruvam, and I am going to want you to indulge in a beautiful tale of misery and winnings.
Okay, I am going to start a story with 2 storylines running in parallel. One for Kotlin against Java and one Flutter against React Native. Try to keep up! It’s going to be a hell of a Game of Thrones here!
A few months back:
Has it ever bothered you that there is a long list of Youtube tutorials or Medium Articles left that you think you need to learn right away? Learning has never been easy, and something so vast like Android is far more than easy. I have always tried to learn as much as I could gulp in one go because there is just too much. One has to decide what is important and what is not and it will stop bothering you.
I work in a start-up and I am a one-man army in the Mobile team. I built an Android app that hosts a gaming site with a webview and built a native update framework from scratch because our app is not on Play Store. I added Firebase tooling to get realtime crashes, analytics, control features, see how the roll-out is working. All this had to be done fast and iteratively because we were short on resources. And all that was built with Java.
All of this was working great until we thought that that was that. We need more control over the experience and decided to go over our choices. Options that we had in our bag were:
2. React Native
3. Android and iOS native.
I am going to stop you right here and point out most of the reasons I considered while deciding the game. Here you go. Read and come back.
I published that article in September when Hero animations were still janky. But Flutter is improving and it’s improving fast.
Flutter Blocker #1: Countless Issues
Do you see the number of issues in Flutter’s Github repository? Oh yeah, my boss saw that and decided to drop this all together. And he saw React Native’s Github Repository, which was beautiful like this:
I know what you are thinking, that Flutter came just 2 years ago and React Native has been there for 4 years and that is why there is such a difference. And I know you might be thinking that considering Flutter is new to Developer’s Market, it is a favourable choice.
But anyone working in a startup knows how bosses and leaders can be. They see the end results, how much it is going to be effective in terms of bringing money and increasing retention %, and I don’t blame them for that. And so in his mind, the idea was dropped already!
Deep breaths everyone. It’s going to be fine.
So my existing webview based project was still and still is, in the running and something had to be done to avoid all the crashes that were being reported in Firebase Crashlytics. Emails like this was being generated almost every 3rd week. These were the great NullPointerExceptions. I tried my best to knock out those exceptions, but for a one-man army, crashes were almost walking on the sidelines here. We had it running because until the Hybrid Solution was ready, we need to distribute this application.
Switching from Java to Kotlin was my call to make. It was based on a series of factors, like,
- Kotlin Null Safety.
- Functional Paradigm. (And I love it)
- Concise and crisp language.
- Kotlin Extensions. (They are ❤️)
- Kotlin Coroutines.
So the Java code was converted to Kotlin code successfully. But in the process, I lost a few lines and that cost me a lot of time.
Quite naturally, the code that came out after conversion wasn’t fully tested and complete. I had to make a lot of changes and test a few things. I had converted the code and changed the code as per the requirement.
Class level Annotation was removed automatically and lost in the conversion.
- I had a Keep annotation in a few models classes (POJOs) in the update framework and its loss was a true difficulty in finding.
- The update feature completely stopped working and there was no way for the users to be brought back if they had got that APK. It was a dead-user bringing.
- The feature was working absolutely fine in debug builds and not in release builds.
- Because the Application is not on Google Playstore, no update is possible.
Because I had faced a few issues like this before, so it became easier to find out where the problem was. And it was my turn to take the blame. The code was obviously corrected and immediately uploaded. Thankfully no major issue occurred here.
An obvious statement: TDD to be followed from now on.
Storyline 2 finishing statements:
After a lot of hard work, the application was now a 100% Kotlin, all done singlehandedly. The output produced is very clear and supportive of the hard work put in.
- Most of the network requests response time has reduced by at least 200ms -1.08s.
- Percentage of frozen frames have fallen by at least 10–20%. That speak volumes.
- Retention % has increased by 7%.
- Crash-free % has increased by 9%.
Even after a few mistakes were made and many instances were learned in the process, we came out winning.
I decided to point out my mistakes in the hope that none of you faces anything like this.
Storyline 1 Continued:
After falling behind the Flutter blocker #1, I had to come up with more success stories and how it is going to be good for the start-up to pick up Flutter and how we can benefit from the fast development time to reduce Time-to-Market.
But before that could happen, we fell behind another Blocker.
Flutter Blocker #2: Code-Push
Code-Push is a feature that lets you send out updates to your application without the user having to explicitly know about it. This is a huge time saver because the release process is a huge blocker.
With the application not on the Play Store, it becomes increasingly difficult for us to make the user download a new update and this allows the user to leave the app forever.
Okay, you can say that I am a F.R.I.E.N.D.S fan.
React Native already have this, code-push and everyone was inclined toward React Native by now. And I am not against React Native, But I am not just into React Native.
I had to bring something productive against both the technologies. Something that would not be biased in favour of any of the technologies.
I had to do what I do best:
I decided to build a flutter application with animations and with a similar structure as of our Web app so that I can convince my Team Lead that we can build the app in a really short time.
And it turns out my boss was impressed. The application was built in record time. All of this was built within 6 hours.
This application and various Flutter advantages when brought into factor, Flutter was chosen as the approved choice for the Gamezop-Project-2020.
If you made it till here, I would love to know your reaction or review to this article. Claps are appreciated. 👏
Until next time.😊