I do have a lot of experience with Kotlin, but I'm...
# announcements
l
I do have a lot of experience with Kotlin, but I'm afraid that I'll flood them with too much information that seems trivial for me
a
Do you use Lombok in Java projects?
l
Not usually, no
Getters and Setters everywhere
a
Then data classes should definitely be in your presentation
l
I will, but I'm kinda prepared to hear a lot of "So what if it's verbose? It works... Why would we change?"
So I'll try to focus on things that Kotlin offers securely, and that Java can't. Such as null-safety
h
I'd at least include a bulleted list of other great features (such as data classes), maybe as a closer
k
I think the verbosity part is actually really important: in Java I was always reluctant to create those small pair-like classes, you need a new file, constructor, getters, ... and now it's just
data class Node(val pos: Point, val cost: Int)
somewhere.
h
I agree, you wont have bugs in code you didnt have ot write
Maybe generate some stats too. Found X tickets in the issue tracker caused by NPE. Found Y tickets regarding equals/hashcode issues (which you get with data classes). etc
👍 1
j
that's funny, I'm also doing a presentation next week about the exact same thing. Although the backend team will only start with Spring Boot this year and I'll have to convince them to use Kotlin right away.
What I came up with so far is doing live coding (Java code exists, then live converting it to Kotlin) about these topics: - Filter & Map examples to showcase the standard lib - Class extensions - Null handling - Data classes + immutability - Other features (smart casts, when with range) - Advanced (Higher order functions)
j
Coroutines is an advanced topic but one of the best features of the language IMO, given how painful Java is for asynchronous programming 🙂 You can show 1 or 2 slides that compare how you would chain few different asynchronous functions in Java (using either callbacks or reactive library) vs Kotlin coroutines. For example you can show a trivial example that does exception handling, for loop iteration on a list with conditional ending of that loop depending on the result of an async computation using the current item in the list (just an idea).
👍 2
Something like https://pastebin.com/QNtYxG0d for example. I leave you with the joy to translate that to Java, but I'm pretty sure it will be much less readable/debuggable (which is super important and should be stressed as well).
👍 1