Live data from Hacker News

Learn Kotlin in Y Minutes

learnxinyminutes.com

121–130 of 239 posts

Re: Learn Kotlin in Y Minutes

#121
post #66

Earlier quoted context omitted.

There weren't any risk before apart form the kotlin plugin not working with beta versions of the gradle build plugin. Using kotlin in Android is like using a library, and you don't have official support from Google for all popular libraries used in Android.

The risk was that you might end up with a code base that you cannot find developers that will work on it/maintain it in the future. The Android support should pretty much guarantee that there will be enough developers familiar with it in the future.

If you are an Android developer you should be aware of kotlin long time and and also tried and use it. Good Android developer knew kotlin before, now you will face more noise to find them.

It is like hiring something who doesn't know the most used libraries in Android. And the risk is exactly the same. The language is not difficult to learn, not much more than a mid-complex library.

Re: Learn Kotlin in Y Minutes

#122
post #41

> Declaring values is done using either "var" or "val". "val" declarations cannot be reassigned, whereas "vars" can. I wonder why they decided on these very mistakable names. Why not const/constant/cons/whatever else just as long it's distinguishable from each other?

I'm personally a fan of the Rust way, i.e. `let` for const bindings and `let mut` for mutable ones. I think it's fairly clear which is which, and having to type four extra characters to get mutability helps reinforce the notion of const being the default choice.

I agree with making mutability require more typing, although I'd prefer going without the redundant `let`.

Re: Learn Kotlin in Y Minutes

#123

Earlier quoted context omitted.

They might be referring to the update methods: val array = new Array[String](10) array.update(7, "hello") array(7) = "hello" // simply calls out to update

I still fail to see what makes this questionable. It's just syntactic sugar that you don't even need to use, and which is pretty clear when you see it in the wild.

Oh yeah I don't think it's questionable at all, just guessing what they're talking about.

Re: Learn Kotlin in Y Minutes

#125
post #84
post #41

Earlier quoted context omitted.

I'm personally a fan of the Rust way, i.e. `let` for const bindings and `let mut` for mutable ones. I think it's fairly clear which is which, and having to type four extra characters to get mutability helps reinforce the notion of const being the default choice.

If your 'let' doesn't propagate so that immutable collections are used, it's not very valuable. Just like 'final' in Java doesn't prevent anyone from mutating your ArrayList. Using 'val' instead of something more suggestive like final/const/'not mut' seems a lot nicer to me. (Edit: and indeed Kotlin having "mutableListOf" and "listOf" separation is a good step in readability. The val/var before either of those is les…

> If your 'let' doesn't propagate so that immutable collections are used

It does; if you don't use `let mut`, you can't mutate the variable at all, which includes the contents of a collection.

(Given that someone will mention RefCell if I don't, I'll add: "barring unusual trickery".)

Re: Learn Kotlin in Y Minutes

#126
post #25

I'm a bit disappointed that there's no metaprogramming support in Kotlin. Even Groovy had some AST-level transformators. Maybe we'll get some high-level API for writing APT-level tools in Kotlin itself ...

Maybe inline functions may be used for some basic metaprogramming, but I'm not sure https://kotlinlang.org/docs/reference/inline-functions.html

Re: Learn Kotlin in Y Minutes

#127
post #106

the whole kotlin debate is just a misguided stab at solving the pain that is programming for android. everyone everywhere hates android dev work. so they think that it must be java. no, java sucks, but kotlin sucks just the same. the problem is the android ecosystem as a whole. the ever changing apis. etc. wasting time on java vs kotlin is absurd with so many other real problems.

Probably everyone will try to hide your comment but that's the truth, there hasn't been a worse ecosystem than Android, learning the Android SDK it's so painful that even if they choose a decent language like Python to support it won't change the fact that the APIs would still be called in the same way, just look at the examples, same just sugar-coated flavor: https://github.com/JetBrains/kotlin-examples/blob/master/gra... vs https://github.com/JetBrains/kotlin-examples/blob/master/gra...

Re: Learn Kotlin in Y Minutes

#128

> Declaring values is done using either "var" or "val". "val" declarations cannot be reassigned, whereas "vars" can. I wonder why they decided on these very mistakable names. Why not const/constant/cons/whatever else just as long it's distinguishable from each other?

I find this syntax very clear, usually start with val and try to stick to it. Moving to var is one char-change only. Also val stands for "value" which is a well known term for immutable data. I think about const as static values, while val are instance values.

Re: Learn Kotlin in Y Minutes

#129
post #78

Earlier quoted context omitted.

Not only does official support matter, it matters much more than whether or not the language is good. I keep learning that lesson again and again in the hard, painful way.

As a new developer I'd like to hear more about why this is?

If a language or tool is officially supported, then that means the project maintainers (Google, in this case) promise to support its use with official documentation, priority bug fixes (for example, if an Android update breaks your app which is written in Kotlin and uses only public, non-deprecated APIs, Google will consider it just as high-priority a bug as if it were written in Java), and first-class access to new APIs as soon as they're created.

Re: Learn Kotlin in Y Minutes

#130

Is anybody here using Kotlin for back-end work? It seems like I generally hear Kotlin come up in connection with Android, and less for writing server code, though that's where I'd potentially like to use it.

I've used Kotlin for standalone Java programs, it's great. According to Jetbrains, it's roughly 50%:50% between Android guys and Java guys. I guess, after yesterday announce it'll shift to Android.

For example Spring announced that Kotlin will be first class citizen with next major release. So things are definitely bright on the server side.

Post reply on HN