6 ms·
My 5 cents: It seems to me that the author did not spent enough time to learn Kotlin. The way he mixes Java types (Integer.parseInt) inside pure Kotlin code an
by johnwick17 8y ago
My 5 cents:
It seems to me that the author did not spent enough time to learn Kotlin. The way he mixes Java types (Integer.parseInt) inside pure Kotlin code and then complains about lack of Null-Safety? It is enough to use an extension function String.toInt() to stick to Null-Safety and compiler will do the rest.
His main() function? Another weird argument because Kotlin's documentation has some examples on how to write it. Author lacks understanding of how Kotlin is converted to Bytecode.
Complaining about such insignificant things like class literals or variable name shadowing (there is a compiler warning for that!) makes me want to shout: Hey, Kotlin is the most amazing language ever if those issues ended up as #1 and #4 on authors "bad bad Kotlin" list...
Generally speaking, when someone writes about a programming language in a bit hateful way it is better to learn the language first.
- kodablah 8y agoYup, I wrote a longer form of basically this. I wouldn't want the person posting to make the language decisions at my company.
- on_and_off 8y agoOr 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.
- kodablah 8y agoA bit too far I'd say. I'd probably happily work with him.
- johnwick17 8y agoI have seen his other posts and he is a smart guy. No idea what bit him with Kotlin though...
- jxub 8y agoProbably drinking too much koolaid from the AbstractBeanContainerMappingClassFactory... Sadly, this might be a classic example of the the Blurb paradox.
- cowmoo728 8y agoDisclaimer: not super familiar with Kotlin or Java. Safely calling option.map and having the function assume it's not called with null is very useful. Is that a real drawback to Kotlin or is there something missing from this post?
- kodablah 8y agoCalling Optional.map(foo -> foo.bar) is effectively equivalent to foo?.bar in Kotlin. What GP was saying is that the author is using things like parseInt and other non-idiomatic things because the author is not familiar enough with the language. Even if it weren't about parseInt vs toInt, the author could have used "number?.let(Integer::parseInt)" instead of "number?.let { Integer.parseInt(it) }" (but of course "number?.toInt()" is the idiomatic way to convert a nullable string to a nullable int).
- johnwick17 8y agoNow that I look at the article, it occurred to me that author might have already been biased when trying Kotlin out and was already certain about the outcome hence the rather poor argumentation. The article itself is rather poorly organized and chaotic as well.
- Latty 8y agoThere is some value to the criticism where it's easy for Java programmers to do the wrong thing because it's possible when they shift over. Of course, that's the price you pay for compatibility with Java, but maybe there should be tooling which can give warnings where you are using commonly abused Java tools where you'd be better off using Kotlin-specific ones.
- batbomb 8y agoThere is, it's called IntelliJ.
- solidninja 8y agoI have to agree. Sometimes you do find developers with so much tunnel vision of the "one true way" that it becomes difficult to open their minds to doing things slightly differently. For example, the null safety example and the complaint that having `!`, `?`, `!!` is "too Scala like" and too complex. I wonder if the author ever had to reason about <? super T> or <? extends T> in Java (e.g. https://briangordon.github.io/2014/09/covariance-and-contravariance.html https://briangordon.github.io/2014/09/covariance-and-contrav...). Scala doesn't even have these sigils (there is a different syntax for variance, type bounds and context bounds - but that's about all there is). Another example - "In the C-family of programming languages, we have the standard way of declaring types of things." At that point you may as well point out that maybe Kotlin isn't in the C family.
- lokedhs 8y agoFirst let me tell you that I agree with you, and I just have a small comment. The type bounds in Java are there for a reason. Kotlin's syntax is simpler but it it unable to express all the types that the Java model can. I have found myself in situations where I want unable to express the proper type information in Kotlin simply because the designers of the language decided that having full support was too complicated.
- paulddraper 8y agoScala does have wildcard types. List<? super T> is List[_ >: T] List<? extends T> is List[_ <: T] Scala leave a feature out? Psht...always room for one more.
- solidninja 8y agoRight, you can use _ as the placeholder for a type and it works with the bounds syntax. I probably did not make it clear enough - my point was that Java is also not as "simple" (for some definition of "simple" the author could use) as you'd expect. For good reasons too - these bounds are useful to have sometimes!
- pvg 8y ago"didn't bother" "bitching" "no clue" "another gem" "hateful" There's really nothing in the article that warrants any of this.
- johnwick17 8y agoOk 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?
- pvg 8y agoIt'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.
- johnwick17 8y agoMaybe 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.
- pvg 8y agoMaybe that's all true but you're not going to fix it by shitcommenting every time you think someone is wrong on the internet.
- jrs95 8y agoOn the other hand, there's not much of anything in the "article" that warrants much of anything different IMO. It's just not serious.