Live data from Hacker News

Android KTX: Kotlin Development for Android

android-developers.googleblog.com

61–70 of 75 posts

Re: Android KTX: Kotlin Development for Android

#61
post #2

Still working in Java on Android. Have a feeling that I will be left behind soon.

I’ve used Kotlin enough to be comfortable but Java is still my go to for personal projects.

Java + StreamSupport + RxJava (and formerly + Retrolambda) is a very modern feeling language.

Heavy use of Optional makes the null safety issues a little less worrying and all my apps are built around AutoValue objects which are a bit like Kotlin data classes.

Re: Android KTX: Kotlin Development for Android

#62

As an alternative to learning Kotlin on Android, you can spend the time learning flutter. Then you get concise code which works on Android and IOS now and on other platforms in the future - including desktops.

Can you point to any apps in the App Store using flutter ? Would be nice to see some real work examples in action.

Re: Android KTX: Kotlin Development for Android

#63

Earlier quoted context omitted.

If it's made by Google, shouldn't we avoid it as it's likely to be discontinued in a few months?

Flutter will be official development platform for Google Fuchsia, their next big OS*. Google is supporting Android and iOS with flutter So that they can have plenty of apps available already when Fuchsia is launched. With the big investment they are doing in Fuchsia it seem unlikely they will abandon it soon.

Big investment? Their next big os?

Please give us some sources, as to me it's just a project a team there is developing, and so far it can just as well be an experiment with no future.

Re: Android KTX: Kotlin Development for Android

#64
post #41

Earlier quoted context omitted.

I don't like this because it forces you to use the tool, and even if you do I've seen so many times when IDE breaks down and won't autocomplete, navigates to compiled binary definition on a same solution project reference, fails to find extension methods so you need to Google which namespace to bring in to get it (which isn't always as simple as class.method search, especially when reading code example snippets), etc…

It doesn't force you to use the tool; it's no worse than the alternative even if you want to write your code in notepad.exe.

Not true, it's very misleading - makes you believe the method is defined inside class body.

Also with functions you know they can't access private members, with extension methods you confuse them with real methods and have to think they can.

It's only the same thing if you know about it and without a tool you can't know, even with tool it takes some inspection.

Re: Android KTX: Kotlin Development for Android

#65
post #2

Still working in Java on Android. Have a feeling that I will be left behind soon.

I’ve used Kotlin enough to be comfortable but Java is still my go to for personal projects. Java + StreamSupport + RxJava (and formerly + Retrolambda) is a very modern feeling language. Heavy use of Optional makes the null safety issues a little less worrying and all my apps are built around AutoValue objects which are a bit like Kotlin data classes.

And apparently Java 10 has ,`var` keyword. It won't be long before Java has all the goodness.

Re: Android KTX: Kotlin Development for Android

#66

Earlier quoted context omitted.

It will take a week or two to convert experienced Java devs to Kotlin.

Yea I agree. I like Kotlin a lot and found the transfer from Java to Kotlin fairly straightforward. Just not all clients are open to one more thing for their devs to do/learn. In the specific case for us, the devs were new to Android so they wanted to use a language they were comfortable in.

If they are new to Android how are they comfortable in Androids' take on Java? Trying to use paradigms from enterprise/server side Java in Android is going to backfire hard on all but the most trivial projects.

Re: Android KTX: Kotlin Development for Android

#67
post #41

Earlier quoted context omitted.

It doesn't force you to use the tool; it's no worse than the alternative even if you want to write your code in notepad.exe.

Not true, it's very misleading - makes you believe the method is defined inside class body. Also with functions you know they can't access private members, with extension methods you confuse them with real methods and have to think they can. It's only the same thing if you know about it and without a tool you can't know, even with tool it takes some inspection.

Extension functions are syntax sugar for static methods that receive the class instance as this. They do not access private members.

Also, you need to specifically import the namespace of the extension function in order to use it, making it very clear to the reader of what is going on. It is not some hidden IDE magic, it's built into the core language.

Re: Android KTX: Kotlin Development for Android

#68
post #32

Curious, is anyone inside of Google using Kotlin for their Android apps, or is this all for third party developers?

Director of project management, Android, said of Kotlin last July: "we're already using it ourselves to write code in Android Studio which gives us more ideas for making our support even better." https://adtmag.com/articles/2017/07/20/android-ama.aspx

Re: Android KTX: Kotlin Development for Android

#69
post #37

As an alternative to learning Kotlin on Android, you can spend the time learning flutter. Then you get concise code which works on Android and IOS now and on other platforms in the future - including desktops.

And it's made by Google, unsurprinsingly. A big plus for Kotlin is that being a jetbrains project, it has top of the line intellij tooling support right at release date.

Except Dart is a worse language than Kotlin.

Re: Android KTX: Kotlin Development for Android

#70
post #41

Earlier quoted context omitted.

It doesn't force you to use the tool; it's no worse than the alternative even if you want to write your code in notepad.exe.

Not true, it's very misleading - makes you believe the method is defined inside class body. Also with functions you know they can't access private members, with extension methods you confuse them with real methods and have to think they can. It's only the same thing if you know about it and without a tool you can't know, even with tool it takes some inspection.

I suspect the design of a class, if I have to worry about whether a method I'm calling is able to access private members or not.
Post reply on HN