What's 

Why 

Kotlin

What's Kotlin ?

Introduced in 2016 by

 

         100% interoperability with Java

Compatible with functional programming

No overhead lambdas

 

Why Kotlin ?

Easy to learn for someone already familiar with Java

 

- Requires less code

​- Deployment is lightweight and faster to compile

- Supports coroutines

- It is compatible with Java's libraries and frameworks

- No more NullPointerException

Null Safety

KOTLIN

JAVA

In Kotlin it is not possible to attribute null values to variables or objects by default.

NullPointerExceptions - enables developers to attribute a null value to any variable.

+1

Extension Functions

KOTLIN

JAVA

Kotlin allows the developer to extend the functionality of classes without necessarily having to inherit from a class.

To extend the functionality of an existing class, one must create a new class and inherit the functions from the parent class.

+2

Code

KOTLIN

JAVA

Typically requires less code and is a very concise language.

Requires more lines of code than Kotlin.

+3

Coroutines Support

+3

KOTLIN

JAVA

Provides coroutines suport. Coroutines are stackless and allow the developer to write code, suspend the execution and later resume it again.

Java enables the creation of multiple background threads when handling lengthy operations.

Data Classes

+4

KOTLIN

JAVA

Kotlin provides a more straightforward way to create classes to hold data by simply including the "data'' keyword in the class definition.

Developers need to establish the fields (or variables) to store the data, the constructor, and the getter and setter functions for the fields/variables, as well as other functions, such as the hashCode(), equals(), and toString().

 Smart Casts

+5

KOTLIN

JAVA

Casting checks are handled by the smart casts feature. Kotlin's intelligent compiler automatically manages redundant casts.

The developer must check the variables' type in consonance to the operation.

Checked Exceptions

+5

Checked exceptions are not available on Kotlin. Thus, Kotlin's developers do not require to catch or declare exceptions.

Java developers have checked exceptions support.

+1

Functional Programming

+6

Kotlin is a mix of object-oriented and functional programming. It can use lambda expressions and high-order functions.

Java is more limited to the concept of object-oriented programming.

+1

Primitive types

+7

In Kotlin, as soon as you initiate a variable of a primitive type, it will be automatically considered an object.

In Java, variables of a primitive type are not objects; they are predefined Java's data types.

+1

Public Fields

+7

Kotlin does not have public fields.

Public fields (also known as non-private fields) are available in Java.

+2

Wildcard Types

Kotlin does not provide wildcards.

Java provides wildcards.

+7

+3

Implicit conversions

Kotlin does not provide support for implicit widening conversions.

Java supports implicit conversions, meaning the developers do not need to perform explicit conversions.

+7

+4

Kotlin wins !

Let's go Kotlin

By Sydelab - Shaping Tomorrow