Jorge Aguilar
Aug 23, 2017 · 1 min read

No, is not “wrong”, is WRONG in any way you look at it, and I don’t think any Java developer will get to that solution cause it doesn’t work, unless all your orders have the same tracking number and that is a value known at compile time.

The only thing you get in kotlin is the syntactic sugar that allows you to do a switch case based on the class, and automatically cast it to that type.

I hate when people try to make kotlin appear as the solution for everything, trying to display it as a glorified language that is all mighty and that Java can’t do the same. Is possible to get the same behavior in Java is just not as pretty because of all the verbosity needed to get it to work.

And don’t get me wrong I like many things about kotlin, but, sometimes it prevents developers from knowing how to do that themselves and when they don’t have the same language features they can’t solve the problems they face.

)