Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Converting Java to Kotlin - Bring your own code
Search
Corneil du Plessis
July 24, 2019
Programming
0
62
Converting Java to Kotlin - Bring your own code
The presentation that accompanied the workshop at I Code Java '19
Corneil du Plessis
July 24, 2019
Tweet
Share
More Decks by Corneil du Plessis
See All by Corneil du Plessis
Sweet Streams (Are made of this)
corneil
0
41
Simplify State management in Spring Boot with HATEOAS and KFSM
corneil
0
320
A Kotlin DSL for finite state machines
corneil
0
680
KFSM - A Kotlin DSL for Finite State machines
corneil
2
1.2k
Logging isn't free
corneil
1
120
The JDK beyond Oracle
corneil
0
130
Spring Fu a quick introduction
corneil
1
630
Reactive Spring 5
corneil
1
150
Resilient Applications using Spring Cloud
corneil
1
120
Other Decks in Programming
See All in Programming
コンテナでLambdaをデプロイするときに知っておきたかったこと
_takahash
0
170
Coding Experience Cpp vs Csharp - meetup app osaka@9
harukasao
0
610
AtCoder Heuristic First-step Vol.1 講義スライド(山登り法・焼きなまし法編)
takumi152
4
1k
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
1.4k
英語文法から学ぶ、クリーンな設計の秘訣
newnomad
1
280
DomainException と Result 型で作る型安全なエラーハンドリング
karszawa
0
840
DataStoreをテストする
mkeeda
0
260
エンジニア未経験が最短で戦力になるためのTips
gokana
0
240
AIコードエディタの基盤となるLLMのFlutter性能評価
alquist4121
0
180
The Weight of Data: Rethinking Cloud-Native Systems for the Age of AI
hollycummins
0
230
AHC 044 混合整数計画ソルバー解法
kiri8128
0
320
PHPUnit 高速化テクニック / PHPUnit Speedup Techniques
pinkumohikan
1
1.3k
Featured
See All Featured
Gamification - CAS2011
davidbonilla
81
5.2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
28
1.6k
Building a Modern Day E-commerce SEO Strategy
aleyda
39
7.2k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.7k
Making Projects Easy
brettharned
116
6.1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Being A Developer After 40
akosma
90
590k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Testing 201, or: Great Expectations
jmmastey
42
7.4k
Measuring & Analyzing Core Web Vitals
bluesmoon
6
360
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
7
630
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.2k
Transcript
Workshop Converting Java to Kotlin Corneil du Plessis @corneil Bring
your own code.
None
Agenda • Brief overview of Kotlin • Converting Ping Pong
TDD – Roman Numerals, more... • Bring your own code. • Questions and Discussions • Java Interoperability • Interesting language features
Kotlin Overview • Improve readability • Reduce cognitive load •
Functional and Object Oriented • Immutability
Kotlin – Functional and Object-Oriented
Zoom
Zoom
Zoom
Zoom
Kotlin – Functional and Object-Oriented
Kotlin – Data Class
Kotlin - Functions
Kotlin – Scope functions Name Invocation It / this Lambda
result or object let receiver.let {} it {} with with(receiver) {} this {} run receiver.run {} this {} apply receiver.apply {} this receiver also receiver.also {} it receiver
Converting code • Converting Ping Pong TDD • Strap in....
Converting – Add dependencies
Kotlin – Maven Dependencies
Kotlin – Maven Plugins • https://gist.github.com/corneil/fdbac43fbc2b0909ea0cb6a0d0fd146a
Kotlin – Maven Plugin
Kotlin – Maven Java Plugin configuration
Interesting Kotlin features – Java interoperability • @JvmName • @get:JvmName
• @set:JvmName • @JvmStatic • @JvmField • @JvmOverloads • @JvmDefault • @Throws • @JvmSuppressWildcards • @JvmMultifileClass
Kotlin - @JvmOverloads
Kotlin - Destructuring Declarations
Kotlin – Delegated Properties • lazy • Non-Primitives. • notNull
• Primitives • observable • Lambda is invoked when modified • vetoable • Lambda can prevent an update by returning false
Kotlin –Delegated Properties
Kotlin - Delegation
Resources • Kotlin https://kotlinlang.org/ • Kotlin Reference https://kotlinlang.org/docs/reference/ • Kotlin
Playground https://play.kotlinlang.org/ • Tutorials https://kotlinlang.org/docs/tutorials/ • More https://kotlinlang.org/docs/resources.html • Awesome Kotlin https://kotlin.link/