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
Scala vs. Kotlin; Friend or Foe?
Search
oshai
July 02, 2018
Programming
0
160
Scala vs. Kotlin; Friend or Foe?
Talk in scalapeno 2018
oshai
July 02, 2018
Tweet
Share
More Decks by oshai
See All by oshai
Maintaining an Open Source The Good, Bad & Ugly
oshai
0
30
KScript
oshai
0
16
Klean Code with Kotlin
oshai
0
60
JVM languages shootout - Java, Scala & *Kotlin*
oshai
0
36
Koroutinify ; Lessons learned from applying Coroutines in Kotlin Backend ; Deep dive into Coroutines
oshai
1
110
Klean that Code, Boil those Boilerplates
oshai
2
61
No forks, One star. Now what?! — How I published my Kotlin Open-Source lib
oshai
0
71
Scala--pack your Future[T]; Kotlin is coming! (Kotlin TLV)
oshai
0
180
X tips [X==9] for building a Bulletproof Deployment Pipeline with Jenkins
oshai
0
44
Other Decks in Programming
See All in Programming
Pythonでもちょっとリッチな見た目のアプリを設計してみる
ueponx
1
550
pylint custom ruleで始めるレビュー自動化
shogoujiie
0
110
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
110
パスキーのすべて ── 導入・UX設計・実装の紹介 / 20250213 パスキー開発者の集い
kuralab
3
760
2,500万ユーザーを支えるSREチームの6年間のスクラムのカイゼン
honmarkhunt
6
5.3k
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
8
1.8k
Ruby on cygwin 2025-02
fd0
0
140
CNCF Project の作者が考えている OSS の運営
utam0k
6
710
Software Architecture
hschwentner
6
2.1k
負債になりにくいCSSをデザイナとつくるには?
fsubal
9
2.4k
Spring gRPC について / About Spring gRPC
mackey0225
0
220
データの整合性を保つ非同期処理アーキテクチャパターン / Async Architecture Patterns
mokuo
46
17k
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
306
110k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.4k
Designing for humans not robots
tammielis
250
25k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
The Cult of Friendly URLs
andyhume
78
6.2k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Why Our Code Smells
bkeepers
PRO
336
57k
Rails Girls Zürich Keynote
gr2m
94
13k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
366
25k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.1k
How to train your dragon (web standard)
notwaldorf
91
5.8k
Transcript
None
None
None
None
Conflicts
Threats • Identify • Compete • Conquer https://www.americanlearninglibrary.com/search/C/caesar/caesar.html
https://ja.wikipedia.org/wiki/%E3%82%B9%E3%83%86%E3%82%A3%E3%83%B3%E3%82%AC%E3%83%BC%E3%83%9F%E3%82%B5%E3%82%A4%E3%83%AB
What is Kotlin • Statically typed • Multi-Platform (JVM first,
JS and Native) • Open Source by JetBrains https://medium.com/@octskyward/why-kotlin-is-my-next-programming-language-c25c001e26e3
Kotlin Features • Concise
Kotlin Features • Concise • Safe
Kotlin Features • Concise • Safe • Interoperable
Kotlin Features • Concise • Safe • Interoperable • Tool-friendly
Kotlin Features • Concise • Safe • Interoperable • Tool-friendly
• Fun
Side by side comparison Scala val hello: String = “hi"
var hello: String = "hi" Kotlin val hello: String = “hi" var hello: String = "hi"
Side by side comparison Scala val hello = “hi" var
hello = "hi" Kotlin val hello = “hi" var hello = "hi"
Case / data class Scala case class Service( name: String
) Kotlin data class Service( val name: String )
Null safety Scala var hello: Option[String] = None hello.foreach {
s => println(s.toUpperCase()) } println(hello.map( _.toUpperCase()) .orNull()) Kotlin var hello: String? = null println(world.toUpperCase()) if (world != null) { println(world.toUpperCase()) } println(world?.toUpperCase())
Singleton Scala object Single { } Kotlin object Single {
}
Enum Scala Coming soon… Kotlin enum class Fruits { Apple,
Banana }
Implicit class / Extension method Scala 5.hours() Kotlin 5.hours()
Implicit class / Extension method Scala object Helpers { implicit
class IntMillis(x: Int) { def hours() = TimeUnit.HOURS.toMillis(x) } } … 5.hours() Kotlin fun Int.hours() = TimeUnit.HOURS.toMillis( this.toLong()) … 5.hours()
Operator overloading Scala It’s actually methods with fancy names Kotlin
Limited to arithmetic operators + - \ * etc’
Pattern matching Scala Cool and Useful! Kotlin Very limited
Implicit conversion Scala Yes we can! Kotlin no no no!
Where Scala shines • Popularity • Evangelism https://www.cvm.org.uk/blog/demolition-squad/eight-evangelism-strategies/
Where Scala shines https://redmonk.com/sogrady/2018/03/07/language-rankings-1-18/
Where Kotlin shines • Java++ - hit the sweet spot
• Great Java inter-op • Lean • Tooling • Pragmatic - not reinventing the wheel
• Compete http://www.zimbio.com/photos/Mesut+Oezil/Germany+v+Argentina/xxHxKC8AyXD
Suggestions for Scala designers • Let’s be practical:
Suggestions for Scala designers • Let’s be practical: • Binary
compatibility https://stackoverflow.com/questions/32255023/how-would-i-go-about-parsing-the-java-class-file-constant-pool
Suggestions for Scala designers • Let’s be practical: • Binary
compatibility • Faster compilation http://www.doodleosophies.com/doodle/30
Suggestions for Scala designers • Let’s be practical: • Binary
compatibility • Faster compilation • Improve Java inter-op
Suggestions for Scala users • Stick to features exists in
Kotlin
Suggestions for Scala users • Stick to features exists in
Kotlin • Make your code readable by all team members
Suggestions for Scala users Move to Kotlin…
Question?
Thank You! @OhadShai