Features of the official programming language of Android - Kotlin

Kotlin is a new programming language from JetBrains. Kotlin is a statically-typed programming language that runs on the Java Virtual Machine. It can be compiled to JavaScript source code. But, it's not a language that can be user for write a kernel. It is of greatest interest to people who work with Java today, although it could appeal to all programmers who use a garbage collected runtime, including people who currently use Scala, Go, Python, Ruby and JavaScript.

Kotlin is a great fit for developing Android applications, bringing all of the advantages of a modern language to the Android platform without introducing any new restrictions. Recently, Google announced that it's adding Kotlin programming language's support in Android at I/O 2017.

Kotlin, which solves many pain points of Java, has been gaining momentum in recent past. Apart from being open source and featuring full Java interoperability, other best features of Kotlin make it something a programming enthusiast must know.

  1. Kotlin is open source - First and foremost, Kotlin in an open source programming language. This statically typed language was built by Jetbrains. Apart from being an open source programming language, Kotlin doesn’t ask much when it comes to converting existing Java code, it happens with a single-click tool.
  2. Kotlin compiles to JVM bytecode - Kotlin compiles to JVM bytecode or JavaScript. Added to this, the programmers who use a garbage collected runtime will also find Kotlin programming language interesting.
  3. Kotlin comes from industry - It solves problems faced by working programmers today. As an example, the type system helps you avoid null pointer exceptions. Research languages tend to just not have null at all, but this is of no use to people working with large codebases and APIs which do.
  4. Full Java Interoperability - One of the best features of Kotlin programming language is its deep interoperability with Java, which is bound to attract more Java developers to learn Kotlin. It runs on the JVM and uses Java libraries and tools. It offers backward compatibility for Java versions 6 and 7.
  5. Kotlin imposes no runtime overhead - The standard Kotlin library doesn’t have garbage, it’s tight and small. It has mostly focused extensions to the Java standard library. Many of its functions are inline-only that just become inline code. Kotlin has many optimizations which, specifically, help Android development.
  6. IDE interop is entirely seamless - Kotlin allows you to keep using your productivity enhancing tools. If you use IntelliJ, code can be refactored, searched, navigated and auto completed as if the Kotlin code was Java and vice-versa. There is full support for debugging, unit testing, profiling and so on.
  7. Adopting Kotlin is low risk - It can be trialled in a small part of your code base by one or two enthusiastic team members without disrupting the rest of your project. Kotlin classes export a Java API that looks identical to that of regular Java code.
  8. Defaulted parameters - The defaulted parameters in Kotlin are pretty handy when you pass the arguments by name, instead of index. Their advantage is seen when there’s a function with tons of optional parameters.
  9. Operator overloading - Operators map to special method names, so can override the behaviour of the existing operators, but you cannot define entirely new ones. This strikes a balance between power and readability.
  10. Extension functions - Thanks to the extension functions in Kotlin, you can add methods to classes without making changes to their source code. Similar to Scala’s implicit methods, you can add methods on a per-user basis to classes. While extension functions are often controversial, every now and then it’s very useful.
  11. Markdown instead of HTML - This makes writing JavaDocs much more pleasant. The “Dokka” tool, which is the equivalent of JavaDoc, can read both Kotlin and Java source code and generate combined doc websites, both with its own style and also in the standard JavaDoc HTML style.
  12. Kotlin wants you to write less code - Unlike Java, which needs you to write everything, Kotlin compiler can understand from the code and write the remaining code, for example, it can infer types in variable declarations. This increases productivity and saves time.
Kotlin stands out in a sea of new programming languages because of its focus on the ecosystem. If you search the web, you'll find tons of ways to solved Java's pain points by Kotlin and features of Kotlin aim to make Android development more fun. You can use it write more expressive and effective code with fewer bugs.


Post a Comment