Kotlin ()
is a
cross-platform
Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
,
statically typed
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a ''type'' (for example, integer, floating point, string) to every '' term'' (a word, phrase, or other set of symbols). Usu ...
,
general-purpose high-level programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
with
type inference
Type inference, sometimes called type reconstruction, refers to the automatic detection of the type of an expression in a formal language. These include programming languages and mathematical type systems, but also natural languages in some bran ...
. Kotlin is designed to interoperate fully with
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
, and the
JVM
A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally descri ...
version of Kotlin's
standard library
In computer programming, a standard library is the library (computing), library made available across Programming language implementation, implementations of a programming language. Often, a standard library is specified by its associated program ...
depends on the
Java Class Library,
but type inference allows its
syntax
In linguistics, syntax ( ) is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituenc ...
to be more concise. Kotlin mainly targets the JVM, but also compiles to
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
(e.g., for frontend web applications using
React) or
native code
In computer programming, machine code is computer program, computer code consisting of machine language instruction set architecture, instructions, which are used to control a computer's central processing unit (CPU). For conventional binary ...
via
LLVM
LLVM, also called LLVM Core, is a target-independent optimizer and code generator. It can be used to develop a Compiler#Front end, frontend for any programming language and a Compiler#Back end, backend for any instruction set architecture. LLVM i ...
(e.g., for native
iOS
Ios, Io or Nio (, ; ; locally Nios, Νιός) is a Greek island in the Cyclades group in the Aegean Sea. Ios is a hilly island with cliffs down to the sea on most sides. It is situated halfway between Naxos and Santorini. It is about long an ...
apps sharing
business logic
In computer software, business logic or domain logic is the part of the program that encodes the real-world business rules that determine how data can be created, stored, and changed. It is contrasted with the remainder of the software that might ...
with
Android apps). Language development costs are borne by
JetBrains
JetBrains s.r.o. (formerly IntelliJ Software s.r.o.) is a Czech software development private limited company which makes tools for software developers and project managers. The company has its headquarters in Amsterdam, and has offices in Ch ...
, while the Kotlin Foundation protects the Kotlin trademark.
On 7 May 2019, Google announced that the Kotlin programming language had become its preferred language for
Android app developers.
Since the release of
Android Studio
Android Studio is the official integrated development environment (IDE) for Google's Android operating system, built on JetBrains' IntelliJ IDEA software and designed specifically for Android development. This is available for download on W ...
3.0 in October 2017, Kotlin has been included as an alternative to the standard Java
compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
. The Android Kotlin compiler emits Java 8
bytecode
Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
by default (which runs in any later JVM), but allows targeting Java 9 up to 20, for optimizing,
or allows for more features; has bidirectional
record class interoperability support for JVM, introduced in Java 16, considered stable as of Kotlin 1.5.
Kotlin has support for the web with Kotlin/JS, through an
intermediate representation
An intermediate representation (IR) is the data structure or code used internally by a compiler or virtual machine to represent source code. An IR is designed to be conducive to further processing, such as optimization and translation. A "good" ...
-based backend which has been declared stable since version 1.8, released December 2022. Kotlin/Native (for e.g.
Apple silicon
Apple silicon is a series of system on a chip (SoC) and system in a package (SiP) processors designed by Apple Inc., mainly using the ARM architecture family, ARM architecture. They are used in nearly all of the company's devices including Mac ...
support) has been declared stable since version 1.9.20, released November 2023.
History
Name
The name is derived from
Kotlin Island
Kotlin (; ) is a Russian island, located near the head of the Gulf of Finland, west of Saint Petersburg in the Baltic Sea. Kotlin separates the Neva Bay from the rest of the gulf. The fortified city of Kronstadt is located on the island and form ...
, a Russian island in the
Gulf of Finland
The Gulf of Finland (; ; ; ) is the easternmost arm of the Baltic Sea. It extends between Finland to the north and Estonia to the south, to Saint Petersburg—the second largest city of Russia—to the east, where the river Neva drains into it. ...
, near
Saint Petersburg
Saint Petersburg, formerly known as Petrograd and later Leningrad, is the List of cities and towns in Russia by population, second-largest city in Russia after Moscow. It is situated on the Neva, River Neva, at the head of the Gulf of Finland ...
. Andrey Breslav, Kotlin's former lead designer, mentioned that the team decided to name it after an island, in imitation of the Java programming language which shares a name with the Indonesian island of
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
.
Development
The first commit to the Kotlin Git repository was on November 8, 2010.
In July 2011,
JetBrains
JetBrains s.r.o. (formerly IntelliJ Software s.r.o.) is a Czech software development private limited company which makes tools for software developers and project managers. The company has its headquarters in Amsterdam, and has offices in Ch ...
unveiled Project Kotlin, a new language for the JVM, which had been under development for a year.
JetBrains lead Dmitry Jemerov said that most languages did not have the features they were looking for, with the exception of
Scala. However, he cited the slow
compilation time of Scala as a deficiency.
One of the stated goals of Kotlin is to compile as quickly as Java. In February 2012, JetBrains open sourced the project under the
Apache 2 license.
JetBrains expected Kotlin to drive
IntelliJ IDEA
IntelliJ IDEA () is an integrated development environment (IDE) written in Java for developing computer software written in Java, Kotlin, Groovy, and other JVM-based languages. It is developed by JetBrains (formerly known as IntelliJ) and is a ...
sales.
Kotlin 1.0 was released on February 15, 2016. This is considered to be the first officially stable release and JetBrains has committed to long-term backwards compatibility starting with this version.
At
Google I/O
Google I/O, or simply I/O, is an annual developer conference held by Google in Mountain View, California. The name "I/O" is taken from the number googol, with the "I" representing the first digit "1" in a googol and the "O" representing the s ...
2017, Google announced first-class support for Kotlin on
Android.
On 7 May 2019, Google announced that the Kotlin programming language is now its preferred language for Android app developers.
Design
Development lead Andrey Breslav has said that Kotlin is designed to be an industrial-strength
object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impleme ...
language, and a "better language" than
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
, but still be fully
interoperable
Interoperability is a characteristic of a product or system to work with other products or systems. While the term was initially defined for information technology or systems engineering services to allow for information exchange, a broader de ...
with Java code, allowing companies to make a gradual migration from Java to Kotlin.
Semicolon
The semicolon (or semi-colon) is a symbol commonly used as orthographic punctuation. In the English language, a semicolon is most commonly used to link (in a single sentence) two independent clauses that are closely related in thought, such as ...
s are optional as a
statement
Statement or statements may refer to: Common uses
*Statement (computer science), the smallest standalone element of an imperative programming language
*Statement (logic and semantics), declarative sentence that is either true or false
*Statement, ...
terminator; in most cases a
newline
A newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. This character, or ...
is sufficient for the
compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
to deduce that the statement has ended.
Kotlin
variable declarations and
parameter lists have the
data type
In computer science and computer programming, a data type (or simply type) is a collection or grouping of data values, usually specified by a set of possible values, a set of allowed operations on these values, and/or a representation of these ...
come after the variable name (and with a
colon separator), similar to
Ada,
BASIC
Basic or BASIC may refer to:
Science and technology
* BASIC, a computer programming language
* Basic (chemistry), having the properties of a base
* Basic access authentication, in HTTP
Entertainment
* Basic (film), ''Basic'' (film), a 2003 film
...
,
Pascal,
TypeScript
TypeScript (abbreviated as TS) is a high-level programming language that adds static typing with optional type annotations to JavaScript. It is designed for developing large applications and transpiles to JavaScript. It is developed by Micr ...
and
Rust
Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH) ...
. This, according to an article from Roman Elizarov, current project lead, results in alignment of variable names and is more pleasing to eyes, especially when there are a few variable declarations in succession, and one or more of the types is too complex for type inference, or needs to be declared explicitly for human readers to understand.
The influence of
Scala in Kotlin can be seen in the extensive support for both object-oriented and functional programming and in a number of specific features:
* there is a distinction between
mutable and immutable variables (''var'' vs ''val'' keyword)
* all classes are public and final (non-inheritable) by default
* functions and methods support
default arguments,
variable-length argument lists and
named arguments
Kotlin 1.3 added support for contracts, which are stable for the standard library declarations, but still experimental for user-defined declarations. Contracts are inspired by
Eiffel's design by contract
Design by contract (DbC), also known as contract programming, programming by contract and design-by-contract programming, is an approach for designing software.
It prescribes that software designers should define formal, precise and verifiable ...
programming paradigm.
Followin
ScalaJS Kotlin code may be
transpiled to
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
, allowing for interoperability between code written in the two languages. This can be used either to write full web applications in Kotlin, or to share code between a Kotlin backend and a JavaScript frontend.
Syntax
Procedural programming style
Kotlin relaxes Java's restriction of allowing
static methods and variables to exist only within a class body. Static objects and functions can be defined at the top level of the package without needing a redundant class level. For compatibility with Java, Kotlin provides a
JvmName
annotation which specifies a class name used when the package is viewed from a Java project. For example,
@file:JvmName("JavaClassName")
.
Main entry point
As in
C,
C++,
C#, Java, and
Go, the
entry point
In computer programming, an entry point is the place in a program where the execution of a program begins, and where the program has access to command line arguments.
To start a program's execution, the loader or operating system passes co ...
to a Kotlin
program is a function named "main", which may be passed an array containing any
command-line
A command-line interface (CLI) is a means of interacting with software via commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternativ ...
arguments. This is optional since Kotlin 1.3.
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language".
Perl was developed ...
,
PHP
PHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by the PHP Group. ...
, and
Unix shell
A Unix shell is a Command-line_interface#Command-line_interpreter, command-line interpreter or shell (computing), shell that provides a command line user interface for Unix-like operating systems. The shell is both an interactive command languag ...
–style
string interpolation is supported.
Type inference
Type inference, sometimes called type reconstruction, refers to the automatic detection of the type of an expression in a formal language. These include programming languages and mathematical type systems, but also natural languages in some bran ...
is also supported.
// Hello, World! example
fun main()
fun main(args: Array)
Extension functions
Similar to C#, Kotlin allows adding an
extension function to any class without the formalities of creating a derived class with new functions. An extension function has access to all the public interface of a class, which it can use to create a new function interface to a target class. An extension function will appear exactly like a function of the class and will be shown in code completion inspection of class functions. For example:
package com.example.myStringExtensions
fun String.lastChar(): Char = get(length - 1)
>>> println("Kotlin".lastChar())
By placing the preceding code in the top-level of a package, the String class is extended to include a function that was not included in the original definition of the String class.
// Overloading '+' operator using an extension function
operator fun Point.plus(other: Point): Point
>>> val p1 = Point(10, 20)
>>> val p2 = Point(30, 40)
>>> println(p1 + p2)
Point(x=40, y=60)
Scope functions
Kotlin has five scope functions, which allow the changing of
scope within the context of an
object
Object may refer to:
General meanings
* Object (philosophy), a thing, being, or concept
** Object (abstract), an object which does not exist at any particular time or place
** Physical object, an identifiable collection of matter
* Goal, an a ...
. The scope functions are , , , , and .
Unpack arguments with spread operator
Similar to Python, the spread operator asterisk (*) unpacks an array's contents as individual arguments to a function, e.g.:
fun main(args: Array)
Destructuring declarations
''Destructuring declarations'' decompose an object into multiple variables at once, e.g. a 2D coordinate object might be ''destructured'' into two integers, and .
For example, the object supports destructuring to simplify access to its key and value fields:
for ((key, value) in map)
println("$key: $value")
Nested functions
Kotlin allows local functions to be declared inside of other functions or methods.
class User(val id: Int, val name: String, val address: String)
fun saveUserToDb(user: User)
Classes are final by default
In Kotlin, to derive a new class from a base class type, the base class needs to be explicitly marked as "open". This is in contrast to most object-oriented languages such as Java where classes are open by default.
Example of a base class that is open to deriving a new subclass from it:
// open on the class means this class will allow derived classes
open class MegaButton
class GigaButton: MegaButton()
Abstract classes are open by default
Abstract class
In object-oriented programming, a class defines the shared aspects of objects created from the class. The capabilities of a class differ between programming languages, but generally the shared aspects consist of state ( variables) and behavior ( ...
es define abstract or "pure virtual" placeholder functions that will be defined in a derived class. Abstract classes are open by default.
// No need for the open keyword here, it’s already open by default
abstract class Animated
Classes are public by default
Kotlin provides the following keywords to restrict visibility for top-level declaration, such as classes, and for class members:
public
,
internal
,
protected
, and
private
.
When applied to a class member:
When applied to a top-level declaration:
Example:
// Class is visible only to current module
internal open class TalkativeButton
internal class MyTalkativeButton: TalkativeButton()
MyTalkativeButton().utter()
Primary constructor vs. secondary constructors
Kotlin supports the specification of a "primary constructor" as part of the class definition itself, consisting of an argument list following the class name. This argument list supports an expanded syntax on Kotlin's standard function argument lists that enables declaration of class properties in the primary constructor, including visibility, extensibility, and mutability attributes. Additionally, when defining a subclass, properties in super-interfaces and super-classes can be overridden in the primary constructor.
// Example of class using primary constructor syntax
// (Only one constructor required for this class)
open class BaseUser(open var isSubscribed: Boolean)
open class PowerUser(protected val nickname: String, final override var isSubscribed: Boolean = true):BaseUser(isSubscribed)
However, in cases where more than one constructor is needed for a class, a more general constructor can be defined using secondary constructor syntax, which closely resembles the constructor syntax used in most object-oriented languages like C++, C#, and Java.
// Example of class using secondary constructor syntax
// (more than one constructor required for this class)
class Context
class AttributeSet
open class View(ctx:Context)
class MyButton : View
Sealed classes
Sealed classes and interfaces restrict subclass hierarchies, meaning more control over the inheritance hierarchy.
Declaration of sealed interface and class:
sealed interface Expr
sealed class Job
All the subclasses of the sealed class are defined at compile time.
No new subclasses can be added to it after the compilation of the module having the sealed class.
For example, a sealed class in a compiled jar file cannot be subclassed.
sealed class Vehicle
data class Car(val brandName: String, val owner: String, val color: String): Vehicle()
class Bike(val brandName: String, val owner: String, val color: String): Vehicle()
class Tractor(val brandName: String, val owner: String, val color: String): Vehicle()
val kiaCar = Car("KIA", "John", "Blue")
val hyundaiCar = Car("Hyundai", "Britto", "Green")
Data classes
Kotlin's
data class
construct defines classes whose primary purpose is storing data, similar to Java's
record
types. Like Java's
record
types, the construct is similar to normal classes except that the key methods
equals
,
hashCode
and
toString
are automatically generated from the class properties. Unlike Java's records, data classes are open for inheritance.
Kotlin interactive shell
$ kotlinc-jvm
type :help for help; :quit for quit
>>> 2 + 2
4
>>> println("Hello, World!")
Hello, World!
Kotlin as a scripting language
Kotlin can also be used as a
scripting language
In computing, a script is a relatively short and simple set of instructions that typically automation, automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming ...
. A script is a Kotlin source file using the
filename extension
A filename extension, file name extension or file extension is a suffix to the name of a computer file (for example, .txt, .mp3, .exe) that indicates a characteristic of the file contents or its intended use. A filename extension is typically d ...
, with executable source code at the top-level scope:
// list_folders.kts
import java.io.File
val folders = File(args .listFiles
folders?.forEach(::println)
Scripts can be run by passing the
-script
option and the corresponding script file to the compiler.
$ kotlinc -script list_folders.kts "path_to_folder_to_inspect"
Null safety
Kotlin makes a distinction between
nullable and non-nullable data types. All nullable objects must be declared with a "?" postfix after the type name. Operations on nullable objects need special care from developers: a null-check must be performed before using the value, either explicitly, or with the aid of Kotlin's null-safe operators:
* (the
safe navigation operator
In object-oriented programming, the safe navigation operator (also known as optional chaining operator, safe call operator, null-conditional operator, null-propagation operator) is a binary operator that returns null if its first argument is null; ...
) can be used to safely access a method or property of a possibly null object. If the object is null, the method will not be called and the expression evaluates to null. Example:
* (the
null coalescing operator
The null coalescing operator is a binary operator that is part of the syntax for a basic conditional expression in several programming languages, such as (in alphabetical order): C# since version 2.0, Dart since version 1.12.0, PHP since versi ...
) is a binary operator that returns the first operand, if non-null, else the second operand. It is often referred to as the
Elvis operator
In certain computer programming languages, the Elvis operator, often written ?:, is a binary operator that evaluates its first operand and returns it if its value is ''logically true'' (according to a language-dependent convention, in other word ...
, due to its resemblance to an emoticon representation of Elvis Presley.
Lambdas
Kotlin provides support for
higher-order function In mathematics and computer science, a higher-order function (HOF) is a function that does at least one of the following:
* takes one or more functions as arguments (i.e. a procedural parameter, which is a parameter of a procedure that is itself ...
s and
anonymous functions
In computer programming, an anonymous function (function literal, expression or block) is a function definition that is not bound to an identifier. Anonymous functions are often arguments being passed to higher-order functions or used for const ...
, or lambdas.
// the following function takes a lambda, f, and executes f passing it the string "lambda"
// note that (String) -> Unit indicates a lambda with a String parameter and Unit return type
fun executeLambda(f: (String) -> Unit)
Lambdas are declared using braces, . If a lambda takes parameters, they are declared within the braces and followed by the operator.
// the following statement defines a lambda that takes a single parameter and passes it to the println function
val l =
// lambdas with no parameters may simply be defined using
val l2 =
"Hello world" example
(Taken from and explained at https://kotlinlang.org/docs/kotlin-tour-hello-world.html.)
fun main()
Tools
*
Android Studio
Android Studio is the official integrated development environment (IDE) for Google's Android operating system, built on JetBrains' IntelliJ IDEA software and designed specifically for Android development. This is available for download on W ...
(based on IntelliJ IDEA) has official support for Kotlin, starting from Android Studio 3.
* Integration with common Java build tools is supported, including
Apache Maven
Maven is a build automation tool used primarily for Java projects. Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages. The Maven project is hosted by The Apache Software Foundation, where it was ...
,
Apache Ant
Apache Ant is a software tool for automating software build processes for Java applications which originated from the Apache Tomcat project in early 2000 as a replacement for the Make build tool of Unix. It is similar to Make, but is implement ...
, and
Gradle
Gradle is a build automation tool for multi-language software development. It manages tasks like compilation, packaging, testing, deployment, and publishing. Supported languages include Java (as well as JDK-based languages Kotlin, Groovy, Sc ...
.
*
Emacs
Emacs (), originally named EMACS (an acronym for "Editor Macros"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, s ...
has a Kotlin Mode in its MELPA package repository.
* JetBrains also provides a plugin for
Eclipse
An eclipse is an astronomical event which occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three ...
.
*
IntelliJ IDEA
IntelliJ IDEA () is an integrated development environment (IDE) written in Java for developing computer software written in Java, Kotlin, Groovy, and other JVM-based languages. It is developed by JetBrains (formerly known as IntelliJ) and is a ...
has plug-in support for Kotlin. IntelliJ IDEA 15 was the first version to bundle the Kotlin plugin in the IntelliJ Installer, and to provide Kotlin support out of the box.
*
Gradle
Gradle is a build automation tool for multi-language software development. It manages tasks like compilation, packaging, testing, deployment, and publishing. Supported languages include Java (as well as JDK-based languages Kotlin, Groovy, Sc ...
: Kotlin has seamless integration with Gradle, a
build automation
Build automation is the practice of building software systems in a relatively unattended fashion. The build is configured to run with minimized or no software developer interaction and without using a developer's personal computer. Build automati ...
tool.
Kotlin Multiplatform
Kotlin Multiplatform allows a single codebase to target multiple platforms such as
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
,
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
, web, Android and
iOS
Ios, Io or Nio (, ; ; locally Nios, Νιός) is a Greek island in the Cyclades group in the Aegean Sea. Ios is a hilly island with cliffs down to the sea on most sides. It is situated halfway between Naxos and Santorini. It is about long an ...
.
Compose Multiplatform is a multi-platform UI framework based on
Jetpack Compose. It is Jetpack Compose for Android ported to Windows,
macOS
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
, Linux, web, and iOS. Jetpack Compose uses a Kotlin compiler plugin to transform composable functions into UI elements. For example, the Text composable function displays a text label on the screen.
Applications
When Kotlin was announced as an official Android development language at
Google I/O
Google I/O, or simply I/O, is an annual developer conference held by Google in Mountain View, California. The name "I/O" is taken from the number googol, with the "I" representing the first digit "1" in a googol and the "O" representing the s ...
in May 2017, it became the third language fully supported for Android, after Java and C++. , Kotlin was the most widely used language on Android, with Google estimating that 70% of the top 1,000 apps on the Play Store were written in Kotlin. Google itself had 60 apps written in Kotlin, including Maps and Drive. Many Android apps, such as Google Home, were in the process of being migrated to Kotlin, and therefore use both Kotlin and Java. Kotlin on Android is seen as beneficial for its
null-pointer safety, as well as for its features that make for shorter, more readable code.
Ktor is Jetbrains Kotlin first framework for building server and client applications. The
Spring Framework officially added Kotlin support with version 5, on 4 January 2017. To further support Kotlin, Spring has translated all its documentation to Kotlin, and added built-in support for many Kotlin-specific features such as coroutines.
In 2020, JetBrains found in a survey of developers who use Kotlin that 56% were using Kotlin for mobile apps, while 47% were using it for a web back-end. Just over a third of all Kotlin developers said that they were migrating to Kotlin from another language. Most Kotlin users were targeting Android (or otherwise on the JVM), with only 6% using Kotlin Native.
Adoption
In 2018, Kotlin was the fastest growing language on GitHub, with 2.6 times more developers compared to 2017. It is the fourth most loved programming language according to the 2020 Stack Overflow Developer Survey.
Kotlin was also awarded the O'Reilly Open Source Software Conference Breakout Award for 2019.
Many companies/organizations have used Kotlin for backend development:
*
Allegro
Allegro may refer to:
Common meanings
* Allegro (music), a tempo marking that indicates to playing quickly and brightly (from Italian meaning ''cheerful'')
* Allegro (ballet), brisk and lively movement
Artistic works
* L'Allegro (1645), a poem b ...
* Amazon
* Atlassian
* Cash App
* Flux
* Google
* Gradle
* JetBrains
* Meshcloud
* Norwegian Tax Administration
* OLX
* Pivotal
* Rocket Travel
* Shazam
* Zalando
Some companies/organizations have used Kotlin for web development:
* Barclay's Bank
* Data2viz
* Fritz2
* JetBrains
A number of companies have publicly stated they were using Kotlin:
*
Basecamp
Mountaineering, mountain climbing, or alpinism is a set of outdoor activities that involves ascending mountains. Mountaineering-related activities include traditional outdoor climbing, skiing, and traversing via ferratas that have become sports ...
* Corda, a distributed ledger developed by a consortium of well-known banks (such as
Goldman Sachs
The Goldman Sachs Group, Inc. ( ) is an American multinational investment bank and financial services company. Founded in 1869, Goldman Sachs is headquartered in Lower Manhattan in New York City, with regional headquarters in many internationa ...
,
Wells Fargo
Wells Fargo & Company is an American multinational financial services company with a significant global presence. The company operates in 35 countries and serves over 70 million customers worldwide. It is a systemically important fi ...
,
J.P. Morgan
JP may refer to:
Arts and media
* ''JP'' (album), 2001, by American singer Jesse Powell
* ''Jp'' (magazine), an American Jeep magazine
* '' Jönköpings-Posten'', a Swedish newspaper
* Judas Priest, an English heavy metal band
* ''Jurassic Pa ...
,
Deutsche Bank
Deutsche Bank AG (, ) is a Germany, German multinational Investment banking, investment bank and financial services company headquartered in Frankfurt, Germany, and dual-listed on the Frankfurt Stock Exchange and the New York Stock Exchange.
...
,
UBS,
HSBC
HSBC Holdings plc ( zh, t_hk=滙豐; initialism from its founding member The Hongkong and Shanghai Banking Corporation) is a British universal bank and financial services group headquartered in London, England, with historical and business li ...
,
BNP Paribas
BNP Paribas (; sometimes referred to as BNPP or BNP) is a French multinational universal bank and financial services holding company headquartered in Paris. It was founded in 2000 from the merger of two of France's foremost financial instituti ...
, and
Société Générale
Société Générale S.A. (), colloquially known in English-speaking countries as SocGen (), is a French multinational universal bank and financial services company founded in 1864. It is registered in downtown Paris and headquartered nearby i ...
), has over 90% Kotlin code in its codebase.
*
Coursera
Coursera Inc. () is an American global massive open online course provider. It was founded in 2012 by Stanford University computer science professors Andrew Ng and Daphne Koller. Coursera works with universities and other organizations to offe ...
* DripStat
*
Duolingo
Duolingo, Inc. is an American educational technology company that produces learning Mobile app, apps and provides Language assessment, language certification. Duolingo offers courses on 43 languages, ranging from English language, English, Fre ...
*
Meta
*
Netflix
Netflix is an American subscription video on-demand over-the-top streaming service. The service primarily distributes original and acquired films and television shows from various genres, and it is available internationally in multiple lang ...
*
Pinterest
Pinterest is an American social media service for publishing and discovery of information in the form of digital Bulletin board, pinboards. This includes recipes, home, style, motivation, and inspiration on the Internet using image sharing. Pint ...
*
Trello
Trello is a web-based, kanban-style, list-making application developed by Atlassian. Created in 2011 by Fog Creek Software, it was spun out to form the basis of a separate company in New York City in 2014 and sold to Atlassian in January 2017 ...
*
Uber
Uber Technologies, Inc. is an American multinational transportation company that provides Ridesharing company, ride-hailing services, courier services, food delivery, and freight transport. It is headquartered in San Francisco, California, a ...
See also
*
Comparison of programming languages
References
* This article contains quotations from Kotlin tutorials which are released under an Apache 2.0 license.
External links
*
{{Programming languages
2011 software
Free software projects
High-level programming languages
Java programming language family
JVM programming languages
Object-oriented programming languages
Programming languages
Programming languages created in 2011
Software using the Apache license
Statically typed programming languages