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
5. WildCard-types
What java does not but kotlin has
1. Lambda Expressions + Inline functions=performant custom control structures
2. Extension functions
3. Null-safety
4. Smart casts
5. String templates
6. Properties
7. Primary Constructors
8. First-class delegation
9. Type inference for variable and property types
10. Singletons
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.
17. Coroutines
Kotlin have rich functionality.
Why Kotlin?
Kotlin is
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).
And Kotlin was not created to replace java or work primarily with only android. It supports multiPlatform applications. Kotlin compiles to Native, JVM, browser and few other JavaScript virtual machines. And Kotlin compiles directly to machine code without Virtual Machine.
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.
THANKS
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Aman Goyal
Aman is an Android developer. Quite good in building logics. Languages he is good in C, C++, java. He is keen on learning new things, flexible, and adaptive to the new environment. Also, have some experience in marketing.