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
170
0
Share
Scala vs. Kotlin; Friend or Foe?
Talk in scalapeno 2018
oshai
July 02, 2018
More Decks by oshai
See All by oshai
Maintaining an Open Source The Good, Bad & Ugly
oshai
0
37
KScript
oshai
0
21
Klean Code with Kotlin
oshai
0
72
JVM languages shootout - Java, Scala & *Kotlin*
oshai
0
56
Koroutinify ; Lessons learned from applying Coroutines in Kotlin Backend ; Deep dive into Coroutines
oshai
1
130
Klean that Code, Boil those Boilerplates
oshai
2
88
No forks, One star. Now what?! — How I published my Kotlin Open-Source lib
oshai
0
79
Scala--pack your Future[T]; Kotlin is coming! (Kotlin TLV)
oshai
0
210
X tips [X==9] for building a Bulletproof Deployment Pipeline with Jenkins
oshai
0
56
Other Decks in Programming
See All in Programming
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
120
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
240
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.4k
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.4k
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
200
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
180
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.8k
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.1k
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.1k
AI時代の仕事技芸論 — ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ
kuranuki
1
610
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
700
Modding RubyKaigi for Myself
yui_knk
0
880
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
190
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
160
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
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