Live data from Hacker News

From Java to Kotlin and Back Again

allegro.tech

71–80 of 199 posts

Re: From Java to Kotlin and Back Again

#71

Earlier quoted context omitted.

Yup, I wrote a longer form of basically this. I wouldn't want the person posting to make the language decisions at my company.

Or have to work with that person, which is especially bad since one of the goals of this kind of posts is to advertise your company.

A bit too far I'd say. I'd probably happily work with him.

Re: From Java to Kotlin and Back Again

#72
post #45

Is it me, or does the article feel like it is written by someone who didn’t actually bother to learn Kotlin. Instead they learnt the bare minimum syntax and tried to write Java in Kotlin. The author complains a lot about how Kotlin is different from Java. Err.. it is a new language — it is supposed to be different — otherwise why bother? > I have my favorite set of JVM languages. Java in /main and Groovy in /test are…

No thats exactly how it's written. It's written by someone who is so stuck in java land and never bothered learning any other language or paradigms.

Re: From Java to Kotlin and Back Again

#74
post #45

Is it me, or does the article feel like it is written by someone who didn’t actually bother to learn Kotlin. Instead they learnt the bare minimum syntax and tried to write Java in Kotlin. The author complains a lot about how Kotlin is different from Java. Err.. it is a new language — it is supposed to be different — otherwise why bother? > I have my favorite set of JVM languages. Java in /main and Groovy in /test are…

I feel the same way: author wants Java and was hoping only for a better Java: compatible with most patterns, tools, even libraries, but addressing some of his pet frustrations. When Kotlin did not satisfy his hopes he got disappointed. Understandably, but I do not see it as the Kotlin problem.

The other problem I have with this post is that it did not state desires/hopes up front. The intro only mentions compile-time null-safety and less boilerplate (for which many languages are better than Java), then adds his desires throughout the text. Thus his complaints seem not a thought through list of failures to satisfy specific desires, but just randomly throwing rocks at vague targets. My 2c.

Re: From Java to Kotlin and Back Again

#75
post #51

val list = listOf("Saab", "Volvo") val map = mapOf("firstName" to "John", "lastName" to "Doe") The above seems a really strange decision for a "new" language - why would you not just use the most common structure, being JSON?

Perhaps worth noting that none of that is langauge syntax, it's library syntax. mapOf takes vararg pairs: Pair, and then the 'to' operator is an infix function that makes a Pair.

So you could trivially do your own listOf or mapOf that creates whatever data structure you want, whereas languages with special syntax for this tend to hardcode the result of it. That's a valid choice, sure, but just that there are tradeoffs here rather than it being obviously better one way or the other.

Re: From Java to Kotlin and Back Again

#76
post #51

val list = listOf("Saab", "Volvo") val map = mapOf("firstName" to "John", "lastName" to "Doe") The above seems a really strange decision for a "new" language - why would you not just use the most common structure, being JSON?

Because it allowed them to use basic understandable functions rather than writing special use cases. listof and mapOf are just functions and to is just a infix function that makes a pair out of two elements. It makes far more sense for someone making a language.

Re: From Java to Kotlin and Back Again

#77
post #66

"Kotlin changed the extends keyword into the : operator, which is already used to separate variable name from its type. Back to C++ syntax? For me it’s confusing." Not only C++; C# also. It's not very hard to confuse the author, is it :) I understand it's different from Java he's used to, but that doesn't mean one can hold every such difference against Kotlin. Not being Java isn't in and of itself a fault of a langua…

And that’s not even how C++ uses the colon!

Re: From Java to Kotlin and Back Again

#78
post #48
post #27

TypeScript also has the weird reversed type declaration. I've never understood it; it's so much less natural to read. Having the type first allows you to easily mentally parse it as "A Foo named bob".

It is not weird, in fact it goes all the way back to Algol, a decade before C was invented.

And the highly popular back in the day Pascal picked it right from Algol... Scala and Go follow the same approach, if I'm not mistaken

Re: From Java to Kotlin and Back Again

#79
post #46
post #7

Good and clear summary of Kotlin warts. In the end I couldn't suppress the thought that there was some hidden Polish-Russian rivalry going on ("Kotlin" == "Heinz") ;-)

Heinz is American (and, in the context of the article, a global brand), not Russian.

Sure, it's about the (negative/funny) association. I was recently told about persistent animosity between Poles and Russians; it crossed my mind given JetBrains is a Russian company masquerading as Czech. BTW, I also think that the name "Kotlin" is the worst aspect of the language, especially when you hear how is it pronounced by the authors in Russian. Big plus for language/runtime/transpiler features, big minus for the name.

Re: From Java to Kotlin and Back Again

#80
post #57

Earlier quoted context omitted.

Ok I have overstepped a bit (edited the post), but I will stick to the "did not bother" and "no clue". Documentation for Kotlin is really nice and it is there together with amazing Kotlin Koans online. Do you think that author who so eagerly complains about Kotlin was so eagerly learning it?

It's still pretty much invective (seriously, hateful?) and an invitation to a dumb programming language poop-flinging fest. As to the author of the thing, they just wrote about not liking Kotlin, you're the one who is taking this as some sort of personal affront. How do you know how long they spent learning it? You don't.

Maybe it is just me but when I critique things then I make sure that I am 100% right. This article, in its current form, can do a lot of harm for people who will read it and decide not to try Kotlin because author has had some problems with Kotlin. Problems that are really easy to get pass by if one reads the documentation and really learns the language with an open mind.
Post reply on HN