Kotlin will displace Java in the Android ecosystem.

Kotlin will displace Java in the Android ecosystem.

Survey report on the adoption of Kotlin for Android.

Make a submission

Accepting submissions till 12 Sep 2021, 06:24 AM

Context of the research and research questions

Fragments conducted an online survey with Android developers and teams about Kotlin adoption between March and April 2021. The survey aimed at answering two questions:

  1. The extent of Kotlin adoption in the Indian startup and enterprise ecosystem.
  2. How organizations are leveraging Kotlin and its features beyond UI development i.e., whether Kotlin is used for backend engineering and building data pipelines.

Key findings

Survey respondents were primarily drawn from Android engineers and Android teams in startups, mid-sized organizations and enterprises.

Survey results show that:

  1. Kotlin’s adoption will increase in 2-3 years, with the likelihood that the next generation of entrants in Android software development will be Kotlin native. This will displace Java’s dominance as a programming language for building Android apps.

  2. The results also reinforce that Kotlin is primarily used for UI development. The language’s features and ability for backend engineering is still under-utilized, at least among developers and teams who mainly build Android apps (since the survey respondents are from this demographic).

  3. More importantly, the survey reveals that engineering managers are concerned about moving large Java codebases to Kotlin because of the concern that they will not be able to hire Kotlin programmers and ramp up their teams.

Scroll down to read about the survey sample and detailed findings, and to see the survey questionnarie.

Conclusions and recommendations

Despite the growing demand for Kotlin and the backing of big tech firms such as Google/Android, there still exist skill gaps in the adoption of Kotlin in India. Kotlin has far-fetched benefits beyond Android as well mainly,

  • On the server side, with their interoperability with the Java ecosystem.
  • A cross platform mobile and web application development platform through their Kotlin multi platform.

Organizations appear to be reticent in moving their codebase to Kotlin, especially when the codebases are large. This slow move is compounded by the apprehension that hiring Kotlin programmers will be difficult and that upskilling entire teams will be difficult. The current skill gaps likely exist because most developers depend on learning the language by themselves, without access to formal training, and without community forums where experiential case studies about Kotlin can be shared freely.

We conclude that for organizations to make better progress towards adoption of Kotlin, they have to invest in training and upskilling their employees because Kotlin will be the future for Android development.

Acknowledgements

Survey design and data analysis:

Madhusudhan Sambojhu is founding partner and engineering lead at able.do.

Anand Venkatnarayanan has worked as a cybersecurity engineer for two decades. He is currently editor at Privacy Mode programme and non-executive director at Hasgeek.

Bhavani Seetharaman is Research Associate at Hasgeek.

Zainab Bawa is co-founder, director and Chief Operating Officer (COO) at Hasgeek.

Authors:

Bhavani Seetharaman and Zainab Bawa have written this report. Madhusudhan Sambojhu actively reviewed the report and helped in nuancing the findings and conclusions.

Support team:

Anish TP illustrated the report.

Review and feedback:

We would like to thank:

  1. Vidya Ramakrishnan, senior front-end developer at Hasgeek, for reviewing the report, and suggesting future areas of research.
  2. Arnav Gupta, entrepreneur in EdTech, for detailed inputs on the survey design.
  3. Ragunath Jawahar, independent consultant at Gojek, for reviewing and commenting on the report.

Hosted by

How do you make a great mobile experience? Explore with Fragments. Follow Fragments on Twitter more
Zainab Bawa

Zainab Bawa

@zainabbawa

Madhusudhan Sambojhu

@madz314

Anand Venkatanarayanan

Anand Venkatanarayanan

@anandvenkatanarayanan

Bhavani Seetharaman

Bhavani Seetharaman

@Bhavani-21

Anish TP

Anish TP

@anishtp

Key findings of the survey

Submitted Sep 9, 2021

Based on the historical context of Kotlin’s growth in the Android ecosystem, the survey’s findings reinforce that many users of Kotlin also have a Java background.

Experience levels and comfort working with Kotlin

Despite being a much younger language, Kotlin is the second most popular language that developers are comfortable working with. The survey results also show that most developers have only recently begun working with Kotlin, with a majority of the respondents stating that they have been working with Kotlin for 1-3 years.

{
  "title": {
    "text": ["Since how long have you been", "working with Kotlin?"],
    "orient": "bottom",
    "dy": 20,
    "fontSize": 16
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "width": "container",
  "data": {
    "values": [
    {"category": "> 3 years", "value": 12.3, "label": "12.3 %"},
    {"category": "< 1 year", "value": 30.8,"label": "30.8 %"},
    {"category": "NA", "value": 1.5, "label": "1.5 %"},
    {"category": "1-3 years", "value": 55.4, "label": "55.4 %"}
    ]
  },
  "encoding": {
    "theta": {"field": "value", "type": "quantitative", "stack": true},
    "color": {"field": "category", "type": "nominal", "legend": null}
  },
  "layer": [
    {"mark": {"type": "arc", "outerRadius": 120}},
    {
    "mark": {"type": "text", "radius": 150},
    "encoding": {
        "text": {"field": "label", "type": "nominal"},
        "size": {"value": 18}
        }
    },
    {
    "mark": {"type": "text", "radius": 85},
    "encoding": {
        "text": {"field": "category", "type": "nominal"},
        "fill": {"value": "#fff"},
        "size": {"value": 14}
        }
    }
  ]
}

Style of writing Kotlin code

The data also shows that almost 68 percent of respondents write Kotlin using idiomatic Kotlin code, while 32 percent of the respondents still continue to use Java style of writing code.

{
    "title":{
    "text": "How do you write code in Kotlin?",
    "orient": "bottom",
    "dy": 20,
    "fontSize": 16
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "width": "container",
  "data": {
    "values": [
    {"category": "Idiomatic Kotlin code", "value": 64.6, "label": "64.6 %"},
    {"category": "Java style of code", "value": 30.8, "label": "30.8 %"},
    {"category": "NA", "value": 4.6, "label": "4.6 %"}
    ]
  },
  "encoding": {
    "theta": {"field": "value", "type": "quantitative", "stack": true},
    "color": {"field": "category", "type": "nominal", "legend": null}
  },
  "layer": [
    {"mark": {"type": "arc", "outerRadius": 120}},
    {
    "mark": {"type": "text", "radius": 150},
    "encoding": {
        "text": {"field": "label", "type": "nominal"},
        "size": {"value": 18}
        }
    },
    {
    "mark": {"type": "text", "radius": 55},
    "encoding": {
        "text": {"field": "category", "type": "nominal"},
        "fill": {"value": "#fff"},
        "size": {"value": 14}
        }
    }
  ]
}

Bangalore-based design firm, Obvious Ventures Private Limited, identified this gap in Kotlin adoption i.e., that individuals use Java style of writing code despite moving to Kotlin. This slows down the transition that teams can make to Kotlin. Between February and March 2021, Obvious conducted workshops for mid-career Android programmers and teams on how to write code in Kotlin efficiently.

Ease of working with Kotlin

When asked why their organizations chose Kotlin as a choice of language for building apps, participants indicated faster compile times and less verbosity of code as the key advantages of Kotlin. One of the survey respondents said:

“Kotlin is chosen as the framework for Android app development in my organization mainly due to ease of coding, elimination of null references, and excellent interoperability with Java.”

Yet another respondent highlighted the sentiment that developers use Kotlin because of the features it has to offer.

“Kotlin is much more succinct and fun to use compared to Java. We can achieve more with less boilerplate. It has so many cool features, like nullability checks, stateflows and coroutines without which it wouldn’t be as easy to develop.”

Related to the above, the survey shows that 34 percent of respondents’ organizations have 80-100 percent of their codebase in Kotlin, while 33 percent of the respondents’ organizations have between 0-20 percent of their codebase in Kotlin.

The response below summarizes why developers prefer Kotlin over Java:

“Reduced boilerplate code, improved app stability, better tooling support, better null safety. Overall, increased developer happiness.”

Percentage of codebase migrated to Kotlin in organizations

We also see that approximately 32 percent of respondents had only 0-20 percent of their codebase in Kotlin, indicating that a significant proportion of the industry has still not adopted the language. When probed further, respondents indicated that their organizations were resisting the move towards Kotlin. This was the case for 22 percent of the respondents.

{
   "title": {
    "text": ["What percentage of your", "codebase is in Kotlin?"],
    "orient": "bottom",
    "dy": 20,
    "fontSize": 16
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "width": "container",
  "data": {
    "values": [
    {"category": "0-20 %", "value": 32.3, "label": "32.3 %"},
    {"category": "21-40 %", "value": 9.2, "label": "9.2 %"},
    {"category": "41-60 %", "value": 12.4, "label": "12.4 %"},
    {"category": "61-80 %", "value": 10.8, "label": "10.8 %"},
    {"category": "81-100 %", "value": 33.8, "label": "33.8 %"},
    {"category": "NA", "value": 1.5, "label": "1.5 %"}
    ]
  },
  "encoding": {
    "theta": {"field": "value", "type": "quantitative", "stack": true},
    "color": {"field": "category", "type": "nominal", "legend": null}
  },
  "layer": [
    {"mark": {"type": "arc", "outerRadius": 130}},
    {
    "mark": {"type": "text", "radius": 160},
    "encoding": {
        "text": {"field": "label", "type": "nominal"},
        "size": {"value": 18}
        }
    },
    {
    "mark": {"type": "text", "radius": 90},
    "encoding": {
        "text": {"field": "category", "type": "nominal"},
        "fill": {"value": "#fff"},
        "size": {"value": 14}
        }
    }
  ]
}

Key challenges in working with Kotlin

When asked to describe the major challenges that teams/organizations face in migrating their codebase to Kotlin, the following were identified as key issues:

  1. Null safety and handling nullable objects.
  2. Not enough documentation is available; lack of library support.
  3. Novelty of functional programming for teams that aren’t used to writing code in this paradigm.
  4. Hiring and onboarding developers to ramp up to Kotlin; apprehension among managers whether they’d be able to hire Kotlin programmers.
  5. Syntax confusion for Java developers who now have to work with Kotlin.
  6. Large codebase, and lack of bandwidth to migrate. One respondent specifically pointed out:

“We’re a B2B company. We cannot introduce Kotlin in our SDKs as they will require shipping the Kotlin standard library dependency with the SDK. This can be problematic for apps still using Java as it will increase the SDK size at compile time.”

{
     "title": {
    "text": "Challenges to Incorporate Kotlin",
    "orient": "bottom",
    "dy": 20,
    "fontSize": 16
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "width": "container",
  "data": {
    "values": [
    {"category": "Other", "value": 6.3, "label": "6.3 %"},
    {"category": "Null checks", "value": 9.5, "label": "9.5 %"},
    {"category": "No challenges", "value": 7.9, "label": "7.9 %"},
    {"category": "Coding structure", "value": 19, "label": "19 %"},
    {"category": "Team", "value": 6.3, "label": "6.3 %"},
    {"category": "NA", "value": 28.6, "label": "28.6 %"},
    {"category": "Not migrated", "value": 22.2, "label": "22.2 %"}
    ]
  },
  "encoding": {
    "theta": {"field": "value", "type": "quantitative", "stack": true},
    "color": {"field": "category", "type": "nominal", "legend": null}
  },
  "layer": [
    {"mark": {"type": "arc", "outerRadius": 130}},
    {
    "mark": {"type": "text", "radius": 160},
    "encoding": {
        "text": {"field": "label", "type": "nominal"},
        "size": {"value": 18}
        }
    },
    {
    "mark": {"type": "text", "radius": 90},
    "encoding": {
        "text": {"field": "category", "type": "nominal"},
        "fill": {"value": "#fff"},
        "size": {"value": 12}
        }
    }
  ]
}

Leveraging Kotlin beyond UI development

This survey results show three key findings in this regard:

  1. Developers rarely utilize new tooling in Kotlin such as Jetpack Compose.
  2. The primary comfort of developers is to use Kotlin for UI development. We read this as a bias among the survey respondents who may primarily be UI developers, and who therefore don’t use Kotlin for backend development purposes.
  3. Only 33 percent of the respondents use Kotlin for building data pipelines, again indicating lack of diversity in the roles of survey respondents i.e., the survey has most responses from UI developers rather than from backend developers working with Kotlin.

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Make a submission

Accepting submissions till 12 Sep 2021, 06:24 AM

Hosted by

How do you make a great mobile experience? Explore with Fragments. Follow Fragments on Twitter more