TypeScript developer tries Kotlin again

Im getting there with Kotlin, try something 3 times and it might start to click. Here is my 5 seconds Rosetta stone on Kotlin classes

Comparisons

Lets break the above down

Kotlin

// this is an annotation 
@MongoEntity

Typescript

// this is a decorator 
@MongoEntity

Kotlin

// This class inherits from ProductBase but the primary constructor must be called, (Kotlin classes have more than 1 constructor) 
class PrivateProduct : ProductBase()

Typescript

class PrivateProduct inherits ProductBase { constructor() {super()}  }

Kotlin

// the property called 'public' is a Boolean and it is initialised but you can prefix `lateinit` which is equal to the `!` in typescript
val public: Boolean = false

Typescript

class PrivateProduct inherits ProductBase {
    public readonly public: boolean = false;  
}

Final thoughts

What I like about Kotlin is most of the nice ES6 features have equivalent or near to concepts, destructuring, promises, reactive programming (alright thats nothing to do with ES6), array methods with predicate all that stuff its here in Kotlin, making the learning curve really nice for an experienced JS developer and even less for Typescript friendly JS developer.

Its very fast too, also I am writing an app using Quarkus - a web framework which has very very very fast hot reload, so I don't even miss this feature.

17