Pros and Cons of Kotlin Over Java
Posted By : Aman Goyal | 10-Aug-2017
Why Kotlin better than java?
Kotlin is statically typed programming language. It provides very expressive syntax and reduce 40% lines of code. On gitHub more than 2000 projects in Kotin.
Some issues are encountered in java which is fixed in Kotlin.
1. Null references are controlled by the typed system.
2. No raw types
3. Arrays in Kotlin are invariant.
4. Kotlin provides proper function types.
5. Use-site variance wildcards.
6. Kotlin does not support checked exception.
Some functionalities which are provided by java but not Kotlin:
1. Checked Exceptions
2. Primitive types that are not classes
3. Kotlin doesn't have static member support but java suppports.
4. Non-private fields
What java does not but kotlin has
1. Lambda Expressions + Inline functions=performant custom control structures
2. Extension functions
4. Smart casts
5. String templates
7. Primary Constructors
8. First-class delegation
9. Type inference for variable and property types
11. Declaration-site variance and Type projections
12. Range expressions
13. Operator overloading
14. Companion Objects
15. Data Classes
16. Separate interfaces for read-only and mutuable collections.
Kotlin have rich functionality.
1. Open-Source: Distributed under Apache License, Version 2.0
2. Concise: Approximately 40% less lines of code compared to java.
3. Interoperable: Kotlin 100% interoperable with Java and Android.
4. Easy: Easy to learn especially if you know java.
5. Tool-Friendly: Kotlin Developed by JetBrains, a company renowned for creating development tools.
6. Safe: Avoid errors such as null exceptions(a big headache in java).
Future Plans for Kotlin
1. Kotlin separate common modules and provide or support platform-specific functionality for multi-platform development.
2. Create full-stack projects written in kotlin.