Hey folks. I've been using Kotlin for a while and ...
# announcements
j
Hey folks. I've been using Kotlin for a while and overall I'm sold on the language. I'm currently heading up a review with a view to moving a pretty large team (30+) of devs from Java to Kotlin. Obviously such a move isn't a straight port but would be maintaining existing Java code alongside new code in Kotlin. I'm interested in any experiences other teams have had doing this kind of migration. I'm particularly interested in any challenges around ramping up a new team, compatibility with existing tools (build/code quality/coverage/review) and benefits/drawbacks of large mixed Java/Kotlin projects. So if anyone has any experiences themselves or can point me to some writeups that would be great.
c
I'm actually in the process of doing what you want to do. Road so far: moved team of 5 devs (including myself) to Kotlin. Initial adoption was a bit hesitant, but after a while everyone got on board. Our team is one of half a dozen teams in the company. Currently we still maintain the rule of using Kotlin only for the code owned by our team, but other teams are interested in switching at some point too. Most of the challenges were related to Spring, Hibernate and Jackson, almost all of them were resolved by Kotlin team and respective frameworks' libraries' teams. Currently we hardly ever encounter any Kotlin-specific problems, except when migrating to a new version (which is generally the case with any library, language or framework).
If you have any specific questions, feel free to ask. One suggestion would be to not switch a whole team to kotlin until you have at least one developer who have learned it to some advanced degree and played with it for a while, otherwise there may be a lot of misunderstanding and hiccups without anyone to resolve the problems besides this community, which is the most helpful I've been a part of so far, but still if you work on proprietary code sometimes you encounter a problem which you can't really share publicly.
i
You may find this talk from the last KotlinConf interesting

https://www.youtube.com/watch?v=OmwjrVawHqA&index=19&list=PLQ176FUIyIUY6UK1cgVsbdPYA3X5WLam5

j
Yep. I'm pretty familiar with Kotlin myself (been using it a few months now for another project) and we have a couple more engineers who are somewhat familiar so I am not really concerned about the language itself (beyond the usual concerns of ramping up our more junior devs etc). But, for instance I know there is not yet (although they are working on it) any Kotlin support in Sonar (which is what we use right now for code quality stuff) so I'm just wondering what (if any) roadblocks other teams have hit like that. Thanks for the info and link. I'll continue to dig into everything.
c
There are kotlin-specific tools, like klint and detekt for static analysis.
And sonar support was promised and is coming "as soon as"
j
For the other project (which was a trial run with myself and a couple of the other devs) we had the freedom to just start from scratch without any of our existing tooling. But for migrating the team we are basically locked on Maven, Sonar, Collaborator, GitLab etc. And even where there are alternatives (say Detekt) how that would look when half of our code is Java and half Kotlin.
i
Or maybe better this one, about how to adopt Kotlin in an organization

https://www.youtube.com/watch?time_continue=1173&v=fPzxfeDJDzY

c
It's mostly fine when we introduced Kotlin our project was around 1 million lines of Java code, we had to write some adapter util functions for Kotlin to seemlessly interface with that, but mostly it was for convenience, not necessity, e.g. in a lot of places we were passing class objects in java we created reified adapters for Kotlin code. Otherwise just drop kotlin code into src/{main,test}/java and it'll be fine 🙂
I've heard about some people having problems with maven, because JetBrains prioritizes Gradle support. We use gradle, so my info could be outdated, you can ask in #C0B8PUJGZ
j
Yeh, the Maven support doesn't seem to be great but as far as I can tell it works. At least the small few things I have tried.
Probably a long shot but were you using any code generation in your Java project (Lombok or similar)?
c
Yes, we do, but not in the code which is done by my team, the team which uses it haven't switched to Kotlin, but having Lombok for java and using Kotlin in parallel is not really a problem. If you're asking about using Lombok with Kotlin code, then no.
We do have some code generation, but that's handled by build tool and generates java code, which we then may call from both Kotlin and Java.
j
Ok, thanks!
K 1