Kotlin is a statically typed programming language that runs on the Java virtual machine and also can be compiled to JavaScript source code or use the LLVM compiler infrastructure. Its primary development is from a team of JetBrains programmers based in Saint Petersburg, Russia. While the syntax is not compatible with Java, the JVM implementation of Kotlin’s standard library is designed to inter-operate with Java code and is reliant on Java code from the existing Java Class Library, such as the collections framework. Kotlin uses aggressive type inference to determine the type of values and expressions for which type has been left unstated. This reduces language verbosity relative to Java, which demands often entirely redundant type specifications prior to version 10.
As of Android Studio 3.0 Kotlin is a fully supported programming language by Google on the Android Operating System, and is directly included in the Android Studio 3.0 IDE package as an alternative to the standard Java compiler. The Android Kotlin compiler lets the user choose between targeting Java 6- or Java 8-compatible bytecode.
Development lead Andrey Breslav has said that Kotlin is designed to be an industrial-strength object-oriented language, and a “better language” than Java, but still be fully inter-operable with Java code, allowing companies to make a gradual migration from Java to Kotlin.
Semicolons are optional as a statement terminator; in most cases a newline is sufficient for the compiler to deduce that the statement has ended. Kotlin variable declarations and parameter lists have the data type come after the variable name (and with a colon separator), similar to Pascal.
Variables in Kotlin can be immutable, declared with the val keyword, or mutable, declared with the var keyword. Class members are public by default, and the classes themselves are sealed by default, meaning that creating a derived class is disabled unless explicit keywords in the base class are present to enable it.
In addition to the classes and methods (called member functions in Kotlin) of object-oriented programming, Kotlin also supports procedural programming with the use of functions.
One of the obvious applications of Kotlin is Android development. The platform was stuck on Java 7 for a while (with some contemporary language features made accessible through the use of Retro-lambda or the Jack tool-chain) and Kotlin introduces many improvements for programmers such as null-pointer safety, extension functions and infix notation. Accompanied by full Java compatibility and good IDE support (Android Studio) it is intended to improve code readability, give an easier way to extend Android SDK classes and speed up development.
Kotlin was announced as an official Android development language at Google I/O 2017. It became the third language fully supported for Android, in addition to Java and C++.
Some of the tools that are used for Kotlin are:
- IntelliJ IDEA has plug-in support for Kotlin. IntelliJ IDEA 15 is the first version to bundle the Kotlin plugin in the IntelliJ Installer, and provide Kotlin support out of the box.
- JetBrains also provides a plugin for Eclipse.
- Integration with common Java build tools is supported including Apache Maven, Apache Ant, and Gradle.
- Android Studio (based on IntelliJ IDEA) has official support for Kotlin, starting from Android Studio 3.
- Emacs has a Kotlin Mode in its Melpa package repository.
- Many great libraries for Kotlin.
The above is a brief about Kotlin compiled from various sites. Watch this space for more updates on the latest trends in Technology.