Copy
ANDROID APP DEVELOPMENT
Kotlin for a better tomorrow!
From the desks of Sasikanth Miriyampalli and Sanchita Agarwal, Engineering

Almost 3 years ago when we were starting working on Simple, we made an important decision to write the app in Kotlin instead of Java. Like with adopting any technology, it's never the right time. But this one decision not only helped us stay head-to-head with the changes in the Android development ecosystem but also moved us to better practices to scale and lower the complexity of our codebase. Our entire engineering team is now capable of shipping features in production using Kotlin, quickly and reliably.

Here's what we've been able to achieve using Kotlin and why we vouch for it:

Predictability in the codebase:
Functional programming constructs in Kotlin like immutability made our codebase more predictable, less error-prone and it became simpler for us to move to a new architecture of choice i.e. Mobius. We had to do little to ensure state immutability and use `copy` constructors to update the state instead.
Concise, readable code:
Android KTX provides us with extensions that allow us to write concise, idiomatic Kotlin code like using a buildSpannedString as a DSL for creating `spanned strings` instead of the `SpannableStringBuilder`
Reduced code complexity:
We've been able to write code that does more in less like chaining complex operations on collections which would otherwise involve everything from using `if/else` to `Iterators`.
A more robust app:
Kotlin's null-safety let us build a more robust Android app organically. Instead of the code being littered with the patched on `null` checks, we were able avoid unknown `NullPointerException`'s during runtime and even utilise `null` as type
 to define domain states, API contracts and schemas like the `deletedAt` field in the Room table below.
Built-in discoverability:
In Simple, we require timestamps to both display and store in the database, thus involving a lot of `LocalDate` to UTC conversions. Extension functions allowed us to add conversions on top of the Java date/time functions and make it easy to discover through IDE suggestions. For more, see this package.

While these are some of the most important things that have helped scale our codebase from 27265 to 115362 lines of Kotlin code in over 2 years, there are more such subtleties of the language like sealed classes, exhaustive when blocks, data classes for requests and responses, scoping functions which have reduced our time on maintenance and technical debt over the years.

Based on our success with Kotlin, we have started a series of workshops to help teams adopt it faster and get to writing it idiomatically in order to yield the language's functional superpower. This is just a sneak peek of what we have been able to achieve with Kotlin and there's a lot of scope to further improve our productivity.

PICK OUR AUTHORS' BRAINS

Reach out to our co-authors Sasikanth Miriyampalli and Sanchita Agarwal to understand more about adopting Kotlin. 
 
Chat with Sasikanth
 
 Chat with Sanchita
OBVIOUS CURATES
More perspectives from around us
Using project Kotlin for Android

Jake Wharton

A slightly edited copy of the document presented internally at Square that advocates the use of Kotlin for developing Android apps. 

READ IT HERE →

 

Function Purity

Obvious

All details on Pure Function, why they are important, and code snippets written for the Java virtual machine using Kotlin. 


READ IT HERE →


CashApp case study using Kotlin Multiplatform

Kotlin

A case study on how Cash App, a peer to peer payment app leveraged Kotlin Multiplatform and all its benefits, while increasing developer happiness and productivity.


READ IT HERE →

 

How we made Basecamp 3's Android app 100% Kotlin 

Signal V. Noise

A detailed account of how Basecamp 3 was built using Kotlin, and their process of shifting from Java to Kotlin. 


READ IT HERE →
IN OTHER NEWS
Updates from us 


The Obvious path from an engineering internship to a full-time Androider 

Read about Janhavi Singh's journey from being our first Android intern to becoming a full-time Android developer, and her learnings along the way. 

CHECK IT OUT HERE →


A Workshop on Writing Kotlin Efficiently by Obvious Engineering Team

If you're an Android developer new to Kotlin or moving from Java to Kotlin, we're hosting a 2nd edition of Kotlin workshop on 24th March. 

REGISTER HERE →

WE'RE HIRING
Join the team

OBVIOUS
Android Engineer

Leverage Android application development experience, own features, and work with existing systems to build empathetic digital products.

VIEW JOB POST→

OBVIOUS
Product Designer

Make sense of complex systems, turn ambiguity into opportunity, and bring ideas alive through design with a team that believes in compasses over maps. 

VIEW JOB POST→

OBVIOUS
Lead Android Engineer 

Lead the team to build great digital products with constraint-driven thinking, and serve as a role model for software design and development.

VIEW JOB POST

OBVIOUS X
Senior Product Designer

Convert ideas into tangible prototpyes, create user-first strategies and direct the team's efforts towards solving high risk-return problems. 

VIEW JOB POST→

Website
Twitter
LinkedIn
Instagram
Facebook
 
Read our previous newsletters: Overheard at Obvious archives

Want to change how you receive these emails?
You can update your preferences for how you receive these mails 
or unsubscribe from this list.

Copyright © 2020 Obvious Ventures Private Limited, All rights reserved.

You are receiving this email because you connected with us through our website, or came to one of our events.

Our mailing address is:
Obvious Ventures Private Limited
Level 2, K-Raheja Paramount
138, Residency Road
Bangalore 560025
India

Add us to your address book