3. HISTORY
▸ Not new at all 2011 -> 2012, Saint
Petersburg
▸ Created by Jetbrains
To increase their productivity
Drive company business by
keeping trust
Drive sales of Intellij IDEA
▸ February 15, 2016
▸ Google IO - 2017
4. INTRODUCTION
▸ Industrial-strength Object Oriented language - it is pragmatic
▸ Open Source
▸ Interoperable with Java
▸ Concise and Expressive
▸ Easy to learn
▸ Terrific Support and great tools
▸ Safe
▸ Better Efficiency as a Programmer
5. LANGUAGE FEATURES
▸ Static typing
Compile time
1. Performance is better
2. More reliable
3. Easier to maintain
Type Inference (in contrast to Java)
▸ Object Oriented and Functional
Design around object and supports OO concepts
Not purely functional but :
A. Lambda Expressions
B. First class functions, immutability and no side effects
▸ Lambdas (High Order Functions)
▸ Compatible
▸ Incremental Compilation
▸ Null Safety
Java Code is defensive (NPE)
Safe Call Operator (?)
Safe Cast Operator (as?)
Elvis Operator (?:)
6. LANGUAGE FEATURES
▸ Extension Functions
Extend any class with new feature even we don’t have access to the source
code
▸ Operator Overloading
Can provide implementation for a predefined set of operators like +, =, ==
▸ Generics
Different types, same behaviour
Reflection, smart casts, companion objects, range expressions etc.
▸ Data Classes
Simplify classes
Separate pure data from business logic
9. COMPARE WITH
▸ Same conciseness and expressive code
BUT Kotlin wins
with static typing and null safety
‣ Difficult to compare but …
‣ Very similar where Swift is LLVM based and
C interop
10. THE PRESENT OF THE KOTLIN
▸ Google, Amazon, Foursquare, Capital One, Coursera,
Basecamp,Netflix, Uber, Trello, Pinterest, Corda etc. are using Kotlin
▸ Google I/O
11. THE PRESENT OF THE KOTLIN
▸ It is not only Java/Android language but compile projects
can also compile into JS.
12. THE PRESENT OF THE KOTLIN
▸ JavaScript target, allowing you to compile Kotlin code to JS and
to run it in your browser - Kotlin 1.1.
▸ Concept of common module - platform specific functionality for
multiplatform project - Kotlin 1.2.
A multiplatform project allows you to build multiple tiers of
your application
Reuse the code between JVM and JS
write the business logic of your application once, and
reuse it across all tiers of your application – the
backend, the browser frontend and the Android
mobile app.
13. KOTLIN EXAMPLES
▸ Example 1:
▸ if (object != null && object.getOtherObject() != null) {
String someString = object.getOtherObject().getString();
if (someString != null) {
return someString;
}
return “”;
} —- >JAVA
▸ return object?.getOtherObject()?.getString() ?: “" —-> KOTLIN
▸ Some more examples -> Intellij IDEA
14. THE FUTURE OF THE KOTLIN
★ Support for machine code Kotlin/Native - >
✴ Windows (x86_64 only at the moment)
✴ Linux (x86_64, arm32, MIPS, MIPS little endian)
✴ MacOS (x86_64)
✴ iOS (arm64 only)
✴ Android (arm32 and arm64)
✴ WebAssembly (wasm32 only)
★ iOS applications (reusing code with Android)
★ Embedded systems/IoT (e.g., Arduino and beyond)
★ Data analysis and Scientific Computing
15. DISADVANTAGES
▸ larger file package size than one built purely in Java.
▸ Build time for Kotlin is a little slower using Gradle
▸ Method count