Inside Edistera

Why Kotlin-First Native Mobile App is Best for B2B Commerce

Devanshu Kaushik
|

Why Kotlin-First Native Mobile App is Best for B2B Commerce

Building software for B2B is tough. Building a SaaS (Software as a Service) product has its own challenges. Building an eCommerce solution is equally hard. Combine them together and as a developer, you have on your hands product complexity that is 3x in scale at its inception. Fortunately, with a team that was already experienced in building both SaaS and eCommerce products, we knew some of the correct questions to ask ourselves before starting out on this product journey. We knew that we had five tenets to live by to ensure the success of our customers and implicitly that of our product.

  1. Evolve and deliver fast: No product is ever perfect, in fact it needs to continuously evolve in order to stay relevant. Keeping in mind our 3X complexity (B2B + SaaS + eCommerce), this principle for us is the sword to live or die by. We need to keep in mind that the software we develop will be used by multiple users, namely the staff in their offices and more urgently by field sales reps as well as the buyers of our customers - which means that any issues or feature gaps in the app need to be fixed/filled at an excruciating pace with the ever evolving B2B commerce landscape.
  2. Deliver at scale: Equally important is to remember that our apps won’t only be shipped to our customers, but to their buyer as well which means our product infrastructure and usability requirements must scale exponentially (not linearly) as we grow with clear separation of concerns. So, performance really matters with fast load times and accurate ordering leading to a positive user experience.
  3. Integrate the brand character of our customers: One of our main goals when we started building the product was to give our customers their own B2B store and identity in the B2B commerce space. Thus, product-wide branding and customisation features become more essential than good-to-have.
  4. Buyers often have spotty internet access: Mobile commerce is meant to be convenient, allowing the buyer to place orders anytime, anywhere, from any device. Whether it’s spotty Internet access in the store or that their phone has wifi access, don’t give your buyers a reason not to buy from you.
  5. High frequency ordering workflow: Many B2B buyers prefer to take an order shelf-side as they take stock. A native mobile commerce app can utilise the mobile device’s camera as a barcode scanner, allowing your buyer to quickly place an order whenever the need arises.

While beginning our product journey - we outlined the need for two different  apps - one which will cater to the buyers of our customers’ products (retailers, wholesale buyers, repeat buyers etc.)  and the other which will enable their field sales staff to complete their checklist of daily tasks like customer onboarding, ordering, payment, upselling and cross-selling etc. in a faster and more efficient manner. The buyer end of the spectrum is where the customisation and branding requirement was the top priority. For the app which is going to be used by sales representatives on the field, we kept usability, scalability and speed while keeping a nimble footprint on the echelon. We knew that we had to begin by developing for Android in both cases to ensure maximum market penetration. The question simply was - which language or framework met all these requirements?

There were essentially two sets of choices we needed to make, specifically for Android:

  1. Do we go for a cross-platform solution like Flutter or ReactNative?
    Essentially this meant to opt for a single code base for our apps across platforms like Android, iOS and Web. Flutter is a cross-platform framework that uses a programming language called Dart, both developed by Google. ReactNative is the mobile-specific cousin of the immensely popular web development framework called ReactJS which we had already decided we were going to use to develop our web-based Edistera Hub dashboard. A very tempting choice indeed considering the lesser maintenance overhead, it had the classic “build once deploy everywhere” ring to it.
  2. Or we stick with the first class citizens of the Android world - Java or Kotlin
    Java as a programming language is a household name, to the extent that even those who do not know a word about programming have heard of it. It achieved this status because it has simply stood the test of time. I myself began my programming journey with Android development in Java, and that remained the case for nearly 6-7 years of Kotlin’s own existence. Kotlin on the other hand, was relatively new, but incredibly promising.

It was a tough choice. But we decided to go with Kotlin, because we felt it satisfied all five of our tenets. In fact, it has got even more to offer. Let me explain.

Kotlin vs The Rest

First off, a brief introduction to Kotlin - Kotlin is a general-purpose programming language which is fully interoperable with Java (which as you probably know is a programming behemoth in itself). It was developed by JetBrains (the famed organization behind IntelliJ, which again is an industry standard integrated development environment for developing apps in many languages including Java). The first version was release more than 10 years ago (at the time of writing this post) on July 22, 2011. On 7 May 2019, Google announced that the Kotlin programming language is now its preferred language for Android app developers. Popular apps that lead their respective industries like Lyft, Coursera, Airbnb, Pinterest etc. already have part or whole of their Android apps developed using Kotlin.

Kotlin vs ReactNative and Flutter for B2B eCommerce App

The obvious question at this point is - why we did not go for cross-platform solutions like Flutter and ReactNative? Specially for the Edistera Direct app, we certainly are going to target platforms other than Android (namely iOS and Web) at some point sooner than later. However we looked at a few industry specific eCommerce use-cases from experience and Kotlin’s own product roadmap and realised that a few points tilt the balance in Kotlin’s favour:

  1. Support for device peripherals like camera
    Developing an Android app in Kotlin means built-in first-party APIs to access the camera,  bluetooth and other peripherals which are essential in building B2B eCommerce specific features such as Barcode/QR Code scanners for payments, inventory management etc. Flutter and ReactNative are able to access these too, but are dependant on plugins and modules maintained by third-parties or open-source communities for this. The maintenance/up-gradation of these modules/plugins often correlates directly to the popularity of the framework itself, which as we’ve seen in the past can fluctuate every few years. Kotlin’s endorsement by Google as Android’s preferred language gives much more assurance in terms that these APIs will be available and updated a lot more frequently and on a long-term basis, which helps us to stay on up to date with our feature support.
  2. Access to specific platform features
    In the world of B2B eCommerce user engagement is one of the pillars of customer success. It has one major contributor in the form of Push Notifications. Like in the case of device peripherals, here too Kotlin has first-party API access to OS features like Push Notifications. APIs for Google services (like Maps etc.) are performance-optimised keeping Kotlin language features in mind, and it goes without mentioning how indispensable Location Services provided Google Maps are in order fulfilment, customer relations management from an B2B eCommerce perspective. The first-party nature of these APIs makes implementation and debugging of the associated features much faster.
  3. Smaller Footprint
    Apps built using Kotlin exclusively will tend to have smaller download sizes since these target a single platform - which means that installing fresh or updating the app will take lesser time for the respective end users.
  4. Kotlin aims to be a fully cross-platform language itself!
    Coming to what seems like a major disadvantage when picking a platform specific framework or language - “You will have to code it all again when you target a new platform like iOS? Why not just pick react native and be done with it?” Well, the good news is that spanning across platforms is front and centre on Kotlin’s own product roadmap. With Multiplatform Mobile, it aims to not only support a single codebase for Android and iOS - it does so with a notable difference in approach, which is to support native user experiences on both platforms. This way developers and users get the best of both worlds - while the business logic that governs the app will be written one-time in Kotlin, the User Interface will use native iOS and Android widgets coded in Swift and Kotlin respectively, giving the app’s user a feeling that’s closer home on their platform of choice. Not only that, Kotlin/JS extends this approach to Web. “Okay, so I guess that pretty much covers React Native and Flutter use cases” - but there is more! Kotlin, true to its purpose of being a general-purpose language finds support in popular server side technologies such as Spring, AWS Lambdas, Heroku etc. It is entirely realistic to expect that the majority of our technology stack might be using Kotlin in the near future.

Kotlin vs Java

“So there are advantages to being a first class citizen language of a platform, but don’t these arguments hold for Java too?” - Well some of them do, but many don’t. Java is and will remain a time tested language, but that part also works against it. Here’s how Kotlin is continuously inching ahead on this front:

  1. Faster speed of development
    Kotlin offers syntax that can be far more concise than Java, with less boilerplate code to perform a similar function. It was able to evolve at a much faster pace than Java in the last decade, develop language features (such as coroutines) that are much less resource intensive when it comes to parallel execution than Java’s thread-based approach. It thus is in line with our first tenet of fastest possible delivery and offers the scalability the second tenet demands.
  2. Provides the opportunity for customisation
    Our third tenet - customisation and branding, was made possible using Jetpack Compose - a modern, declarative UI framework for Android developed by Google entirely using Kotlin. The declarative nature of Compose, and the fact that it is based on the reactive UI paradigm, allowed us to seamlessly integrate brand-specific colour themes for our Edistera Direct’s interface. Theming the app itself used to be an arduous task in the pre-Compose days on Android, and as good as Java is, at the moment, you cannot program Jetpack Compose UI in it. There are similar third-party UI framework libraries that will support Java, but I feel their popularity, usage and upkeep will quickly wane with the rise of Jetpack Compose.
  3. Better backward compatibility
    Kotlin itself was initially programmed using Java 6. This means that its language features will not only absorb the good bits of Java language features in the future, but those new language features will have a much better compatibility with older versions of Android itself. In contrast, a popular Java 8 feature for data processing called “streams”, extensively used in web and server side development, does not find support in Android versions older than Android 9.0
  4. It is fully interoperable with Java itself
    Let’s say that Java indeed comes up with a feature not present in Kotlin at some point in the future which will speed up a part of our development. We can easily adapt in that situation by writing that part of our program in Java, since Kotlin offers 100% interoperability - you can use Java classes in Kotlin, and vice-versa. Opting for Kotlin thus is a pretty future-proof option as well and again supports the scalability aspect of our tenets.

Wow, this seems to have become a long-ish post, but us engineers are known to ramble on about our technologies like that. It is my sincere hope though, that I was able to showcase the advantages of choosing a B2B commerce mobile app built on a stack as reliable, and as flexible as that offered by Edistera so that you know you are in good hands. To provide an exceptional mobile commerce experience for your buyers, investing in a Kotlin mobile commerce app in lieu of a mobile web experience is critical.

If you wish to experience our product in action in all it’s Kotlin glory, sign up for a 10-minute call with our specialist today.

Last Updated :
July 27, 2022
Published :
18/7/2022

Keep reading