Recently Google made Kotlin a first class language for Android. For the past 1-2 years, it has been getting a lot of traction. We should surely evaluate its usage in our project. Here's a very interesting take on it. @misaochan @tobias47n9e @neslihanturan
It appears that Android Studio's support for Kotlin is still in pre-release. (although you can manually add the required plugin.)
Yes still in pre-release. Can be used with the canary build of Studio.
I don't have any expertise with either language. I looked at the Koitlin article and it seems like it is a well designed language. I wouldn't have any issue with switching.
Wow, interesting! I wonder if there are any stats on which other apps have converted to Kotlin (either partially or fully), and how it worked out for them?
I second the use of Kotlin, I've been using it in a personal project for a couple of months and it is a pleasure to use. The Kotlin plugin has been stable for a few years now, the only difference is that Android Studio will finally provide it with the editor. There are also a lot of resources on Kotlin as it is very big in the developer community.
A major supporter of Kotlin are the guys at Square which is arguably the most influential team in Android development.
Could it be used for writing tests here? Unit tests can use more readability and it appears like Kotlin can be of help, and doing something experimental there is safe (in the sense that it's separate from the main code).
Here is my attempt: https://github.com/whym/apps-android-commons/commit/e9fb3d8ac5aad70f8261b2cd513966ce44d64b9e
I like to be able to separate words in function names such as "@Test fun `strip nothing from non-localized string`()". It causes some warnings ("Identifier not allowed in Android projects"), though.
Kotlin? :)) awesome 馃憤
Andrdoid Studio 3 has been officially released and I submitted #958.
Can we use Kotlin in new classes / modules? Using android-extensions allows us to stop using butterknife, and Kotlin is fully interoperable with java
Can we use Kotlin in new classes / modules? Using android-extensions allows us to stop using butterknife, and Kotlin is fully interoperable with java
Personally I would be in support of limiting Kotlin to tests for the time being - there are lots of overhauls going on with the codebase at the moment, and adding Kotlin to the mix would make things rather messy IMO. Plus it would add another barrier to entry for new contributors.
In my opinion we could try it with tests for the next few months (I believe the recent PR to use Kotlin for writing tests was our first ever), and then see how it goes before making a decision on whether or not to start adding it to the main codebase.
@maskaravivek Sir, isn't is the right time to move to Kotlin from Java?
@madhurgupta10 I would suggest looking through the code and creating some tests - help us to make a better evaluation of the language by demonstrating its usage.
@psh Hi Sir, could you please tell the specific test that should I make in Kotlin?
We recently attended the Wikimedia Technical Conference 2019 and a few people suggested to start using Kotlin in our codebase.
@misaochan @neslihanturan @ashishkumar468 @nicolas-raoul @dbrant Do you guys have any thoughts on this?
Kotlin is where the ecosystem is heading, without a doubt. Even all the code samples in the Android framework documentation are now Kotlin-first. It's definitely a much better language than Java, for various reasons that I won't argue here. Once you get used to it, you won't want to go back.
However, there shouldn't be any rush to convert all of your _old_ classes from Java to Kotlin, since it compiles to the same bytecode, and therefore doesn't really provide any performance benefits. I'd suggest that any _new_ classes should be done in Kotlin, and perhaps any existing classes undergoing heavy refactoring should be converted at your leisure.
My concern is what would be the effect of Kotlin usage for newcomers. Do you think people started to know about be familiar with it or still Android developers mostly know Java instead of Kotlin?
How about:
?
That allows a smooth conversion, allows both Java and Kotlin fans to contribute. Java to Kotlin conversion could be the topic of a Google Code-In task, one task for one class among the easy classes. I am sure that within a few years some hardcore Kotlin fan will come and convert the complex classes too.
Sounds like a great movement plan @nicolas-raoul
How about:
- Creating new classes in Java in OK
- Creating new classes in Kotlin in OK
- Converting a class from Java to Kotlin is OK
- Converting a class from Kotlin to Java is forbidden
?That allows a smooth conversion, allows both Java and Kotlin fans to contribute. Java to Kotlin conversion could be the topic of a Google Code-In task, for the easy classes. I am sure that within a few years some hardcore Kotlin fan will come and convert the complex classes too.
@misaochan If you agree to this, we can probably add this in our contribution guidelines. Post that, I will add support(add library dependency) for Kotlin in our codebase.
@misaochan If you agree to this, we can probably add this in our contribution guidelines. Post that, I will add support(add library dependency) for Kotlin in our codebase.
Sounds good to me. Are we all agreed on this? If anyone has any objections, now's the time. We'll wait a week or so. ;)
@misaochan Can we implement this now?
Yes, it looks like we're all good! Go for it. :)
I think it is a good idea to move the utils java files to kotlin since they don't contain much logic and easy to do it!
@macgills Maybe we can keep the issue open for future PRs
I would make an issue if you are converting files, I didn't realise this was linked by your DialogUtil PR.
Regardless nobody wants an eternal issue and to me the purpose of this ticket has been served so I am alright with closing it
Most helpful comment
Sounds good to me. Are we all agreed on this? If anyone has any objections, now's the time. We'll wait a week or so. ;)