SlideShare a Scribd company logo
Shoulders of Giants
Andrey Breslav
Sir Isaac Newton
If I have seen further it is
by standing on the
shoulders of Giants
Letter to Robert Hooke, 1675
Bernard of Charters
[Dicebat Bernardus Carnotensis nos esse quasi]
nanos gigantium
humeris incidentes.
XII c.
Why I’m giving this talk
The right question
Why don’t all language designers give such talks?
Every language has learned from others
Is it morally wrong? Or maybe even illegal?
“In science and in art, there are, and can be, few, if any things, which in
an abstract sense are strictly new and original throughout. Every book
in literature, science, and art borrows, and must necessarily borrow,
and use much which was well known and used before.”
Supreme Court Justice David Souter
Campbell v. Acuff-Rose Music, Inc., 510 U.S. 569 (1994)
Does it make them worse?
• Is originality what really matters to you as a developer?
• Put in on the scale with productivity and maintainability 
• But I want to
• … stand out
• … be proud of my language (and its authors)
• ... win arguments with fans of other languages
• … write awesome software, maybe? 
What do language designers think?
• The Kotlin team had productive discussions with
• Brian Goetz
• Martin Odersky
• Erik Meijer
• Chris Lattner
• … looking forward to having more!
My ideal world
• Everyone builds on top of others’ ideas
• Everyone openly admits it and says thank you
• Difference from academia: it’s OK to not look at some prior work 
So, what languages has Kotlin
learned from?
From Java: classes!
• One superclass
• Multiple superinterfaces
• No state in interfaces
• Constructors (no destructors)
• Nested/inner classes
• Annotations
• Method overloading
• One root class
• toString/equals/hashCode
• Autoboxing
• Erased generics
• Runtime safety guarantees
Leaving things out: Java
• Monitor in every object
• finalize()
• Covariant arrays
• Everything implicitly nullable
• Primitive types are not classes
• Mutable collection interfaces
• Static vs instance methods
• Raw types
• …
From Java…
class C : BaseClass, I1, I2 {
class Nested { ... }
inner class Inner { ... }
}
From Scala, C#...
class C(p: Int, val pp: I1) : B(p, pp) {
internal var foo: Int
set(v) { field = check(v) }
override fun toString() = "..."
}
Not Kotlin
class Person {
private var _name: String
def name = _name
def name_=(aName: String) { _name = aName }
}
Not Kotlin
class Person {
private string _Name;
public string Name {
get { return _Name; }
set { _Name = value }
}
}
Kotlin
class Person {
private var _name = "..."
var name: String
get() = _name
set(v) { _name = v }
}
Leaving things out: Interfaces vs Scala Traits
• No state allowed
• no fields
• no constructors
• Order doesn’t matter
• no linearization rules
• Delegation through by
Some (more) differences…
class C(d: Intf) : Intf by d {
init { println(d) }
fun def(x: Int = 1) { ... }
fun test() {
def(x = 2)
}
}
And a bit more…
val person = Person("Jane", "Doe")
val anonymous = object : Base() {
override fun foo() { ... }
}
From Scala…
object Singleton : Base(foo) {
val bar = ...
fun baz(): String { ... }
}
Singleton.baz()
Companion objects
class Data private (val x: Int) {
companion object {
fun create(x) = Data(x)
}
}
val data = Data.create(10)
Companion objects
class Data private (val x: Int) {
companion object {
@JvmStatic
fun create(x) = Data(x)
}
}
val data = Data.create(10)
BTW: Not so great ideas
• Companion objects 
• Inheritance by delegation 
From C#...
class Person(
val firstName: String,
val lastName: String
)
fun Person.fullName() {
return "$firstName $lastName"
}
Not Kotlin
implicit class RichPerson(p: Person) {
def fullName = s"${p.firstName} ${p.lastName}"
}
class PersonUtil {
public static string FullName(this Person p) {
return $"{p.firstName} {p.lastName}"
}
}
It’s Groovy time!
mylist
.filter { it.foo }
.map { it.bar }
Not Kotlin
mylist.filter(_.foo).map(_.bar)
mylist.stream()
.filter((it) -> it.getFoo())
.map((it) -> it.getBar())
.collect(Collectors.toList())
mylist.Where(it => it.foo).Select(it => it.bar)
Not Kotlin (yet…)
for (it <- mylist if it.foo)
yield it.bar
from it in mylist where it.foo select it.bar
[it.bar for it in mylist if it.foo]
It’s Groovy time!
val foo = new Foo()
foo.bar()
foo.baz()
foo.qux() with(foo) {
bar()
baz()
qux()
}
DSLs: Type-Safe Builders
a(href = "http://my.com") {
img(src = "http://my.com/icon.png")
}
Not Kotlin 
10 PRINT "Welcome to Baysick Lunar Lander v0.9"
20 LET ('dist := 100)
30 LET ('v := 1)
40 LET ('fuel := 1000)
50 LET ('mass := 1000)
60 PRINT "You are drifting towards the moon."
Not Kotlin 
object Lunar extends Baysick {
def main(args:Array[String]) = {
10 PRINT "Welcome to Baysick Lunar Lander v0.9"
20 LET ('dist := 100)
30 LET ('v := 1)
40 LET ('fuel := 1000)
50 LET ('mass := 1000)
60 PRINT "You are drifting towards the moon."
}
}
From Scala: Data Classes
data class Person(
val first: String,
val last: String
) {
override fun equals(other: Any?): Boolean
override fun hashCode(): Int
override fun toString(): String
fun component1() = first
fun component2() = last
fun copy(first: String = this.first, last: String = this.last)
}
val (first, last) = myPerson
Not Kotlin
val greeting = x match {
case Person(f, l) => s"Hi, $f $l!"
case Pet(n) => s"Hi, $n!"
_ => "Not so greetable O_o"
}
From Gosu: Smart casts
val greeting = when (x) {
is Person -> "Hi, ${x.first} ${x.last}!"
is Pet -> "Hi, ${x.name}!"
else -> "Not so greetable o_O"
}
From Groovy, C#: Elvis and friends
val middle = p.middleName ?: "N/A"
persons.firstOrNull()?.firstName ?: "N/A"
nullable!!.foo
(foo as Person).bar
(foo as? Person)?.bar
Java/Scala/C#: Generics
abstract class Read<out T> {
abstract fun read(): T
}
interface Write<in T> {
fun write(t: T)
}
Java/Scala/C#: Generics
class RW<T>(var t: T): Read<T>, Write<T> {
override fun read(): T = t
override fun write(t: T) {
this.t = t
}
}
fun foo(from: RW<out T>, to: RW<in T>) {
to.write(from.read())
}
Do other languages learn from Kotlin?
• I can't be 100% sure, but looks like they do
• xTend
• Hack
• Swift
• Java?
• C#?
• But let them speak for themselves!
My ideal world
• Everyone builds on top of others’ ideas
• Everyone openly admits it and says thank you
• Difference from academia: it’s OK to not look at some prior work 
P.S. My Personal Workaround
In practice, languages are often
selected by passion, not reason.
Much as I’d like it to be the other way around,
I see no way of changing that.
So, I’m trying to make Kotlin a
language that is loved for a reason 

More Related Content

What's hot

Theme Quiz Journey 26.5.'20- Qazi Nazrul Islam Special
Theme Quiz Journey 26.5.'20- Qazi Nazrul Islam SpecialTheme Quiz Journey 26.5.'20- Qazi Nazrul Islam Special
Theme Quiz Journey 26.5.'20- Qazi Nazrul Islam Special
Partha Gupta
 
Prelims
PrelimsPrelims
Rabindra granthagar quiz by chanchal singha
Rabindra granthagar quiz by chanchal singhaRabindra granthagar quiz by chanchal singha
Rabindra granthagar quiz by chanchal singha
chanchal sinhga
 
QC101: The One With The Freshers | Abhinav, Chirag & Sahil
QC101: The One With The Freshers | Abhinav, Chirag & SahilQC101: The One With The Freshers | Abhinav, Chirag & Sahil
QC101: The One With The Freshers | Abhinav, Chirag & Sahil
Quiz Club, Indian Institute of Technology, Patna
 
Agantuk quiz 2017,bansberia,hooghly, final 1
Agantuk quiz 2017,bansberia,hooghly, final 1Agantuk quiz 2017,bansberia,hooghly, final 1
Agantuk quiz 2017,bansberia,hooghly, final 1
Sarat Banerjee
 
100 years since ww1 a bqc quiz with answers
100 years since ww1  a bqc quiz with answers100 years since ww1  a bqc quiz with answers
100 years since ww1 a bqc quiz with answers
Vikram Joshi
 
ANAGONA 2K22
ANAGONA 2K22 ANAGONA 2K22
ANAGONA 2K22
ShouvikMahapatra
 
(Prelims) Filmy Friday - The Bollywood Quiz by Inquizitive - Maharaja Agrasen...
(Prelims) Filmy Friday - The Bollywood Quiz by Inquizitive - Maharaja Agrasen...(Prelims) Filmy Friday - The Bollywood Quiz by Inquizitive - Maharaja Agrasen...
(Prelims) Filmy Friday - The Bollywood Quiz by Inquizitive - Maharaja Agrasen...
Inquizitive Maharaja Agrasen College, DU
 
Finals of 27th January 2018 Quiz at Halisahar by MINDSPORT
Finals of 27th January 2018 Quiz at Halisahar by MINDSPORTFinals of 27th January 2018 Quiz at Halisahar by MINDSPORT
Finals of 27th January 2018 Quiz at Halisahar by MINDSPORT
Suvojit Sarkar
 
Hindi Ent Quiz
Hindi Ent Quiz Hindi Ent Quiz
Hindi Ent Quiz
Debasmita Bhowmik
 
Bollywood Quiz
Bollywood QuizBollywood Quiz
Bollywood Quiz
Om Prakash Chaudhary
 
India Quiz Finals
India Quiz FinalsIndia Quiz Finals
India Quiz Finals
Quest-SGGSCC
 
Bengali Movie Quiz
Bengali Movie Quiz Bengali Movie Quiz
Bengali Movie Quiz
souravkrpodder
 
Mypy pycon-fi-2012
Mypy pycon-fi-2012Mypy pycon-fi-2012
Mypy pycon-fi-2012
jukkaleh
 
Quiz-Saraswati Pujo Quiz-2017
Quiz-Saraswati Pujo Quiz-2017Quiz-Saraswati Pujo Quiz-2017
Quiz-Saraswati Pujo Quiz-2017
Sourav Kumar Paik
 
Sports Quiz_ Prelims_Quizzitch Cup_ 2024.pptx
Sports Quiz_ Prelims_Quizzitch Cup_ 2024.pptxSports Quiz_ Prelims_Quizzitch Cup_ 2024.pptx
Sports Quiz_ Prelims_Quizzitch Cup_ 2024.pptx
Anand Kumar
 
New year quiz finals
New year quiz finalsNew year quiz finals
New year quiz finals
Pramith Menon
 
Sports qz prelims
Sports qz   prelimsSports qz   prelims
Sports qz prelims
Somnath Chanda
 
The next generation JPEG standards
The next generation JPEG standardsThe next generation JPEG standards
The next generation JPEG standards
Touradj Ebrahimi
 
Finals-Bollywood Quiz
Finals-Bollywood QuizFinals-Bollywood Quiz
Finals-Bollywood Quiz
Quintessential_IIFT
 

What's hot (20)

Theme Quiz Journey 26.5.'20- Qazi Nazrul Islam Special
Theme Quiz Journey 26.5.'20- Qazi Nazrul Islam SpecialTheme Quiz Journey 26.5.'20- Qazi Nazrul Islam Special
Theme Quiz Journey 26.5.'20- Qazi Nazrul Islam Special
 
Prelims
PrelimsPrelims
Prelims
 
Rabindra granthagar quiz by chanchal singha
Rabindra granthagar quiz by chanchal singhaRabindra granthagar quiz by chanchal singha
Rabindra granthagar quiz by chanchal singha
 
QC101: The One With The Freshers | Abhinav, Chirag & Sahil
QC101: The One With The Freshers | Abhinav, Chirag & SahilQC101: The One With The Freshers | Abhinav, Chirag & Sahil
QC101: The One With The Freshers | Abhinav, Chirag & Sahil
 
Agantuk quiz 2017,bansberia,hooghly, final 1
Agantuk quiz 2017,bansberia,hooghly, final 1Agantuk quiz 2017,bansberia,hooghly, final 1
Agantuk quiz 2017,bansberia,hooghly, final 1
 
100 years since ww1 a bqc quiz with answers
100 years since ww1  a bqc quiz with answers100 years since ww1  a bqc quiz with answers
100 years since ww1 a bqc quiz with answers
 
ANAGONA 2K22
ANAGONA 2K22 ANAGONA 2K22
ANAGONA 2K22
 
(Prelims) Filmy Friday - The Bollywood Quiz by Inquizitive - Maharaja Agrasen...
(Prelims) Filmy Friday - The Bollywood Quiz by Inquizitive - Maharaja Agrasen...(Prelims) Filmy Friday - The Bollywood Quiz by Inquizitive - Maharaja Agrasen...
(Prelims) Filmy Friday - The Bollywood Quiz by Inquizitive - Maharaja Agrasen...
 
Finals of 27th January 2018 Quiz at Halisahar by MINDSPORT
Finals of 27th January 2018 Quiz at Halisahar by MINDSPORTFinals of 27th January 2018 Quiz at Halisahar by MINDSPORT
Finals of 27th January 2018 Quiz at Halisahar by MINDSPORT
 
Hindi Ent Quiz
Hindi Ent Quiz Hindi Ent Quiz
Hindi Ent Quiz
 
Bollywood Quiz
Bollywood QuizBollywood Quiz
Bollywood Quiz
 
India Quiz Finals
India Quiz FinalsIndia Quiz Finals
India Quiz Finals
 
Bengali Movie Quiz
Bengali Movie Quiz Bengali Movie Quiz
Bengali Movie Quiz
 
Mypy pycon-fi-2012
Mypy pycon-fi-2012Mypy pycon-fi-2012
Mypy pycon-fi-2012
 
Quiz-Saraswati Pujo Quiz-2017
Quiz-Saraswati Pujo Quiz-2017Quiz-Saraswati Pujo Quiz-2017
Quiz-Saraswati Pujo Quiz-2017
 
Sports Quiz_ Prelims_Quizzitch Cup_ 2024.pptx
Sports Quiz_ Prelims_Quizzitch Cup_ 2024.pptxSports Quiz_ Prelims_Quizzitch Cup_ 2024.pptx
Sports Quiz_ Prelims_Quizzitch Cup_ 2024.pptx
 
New year quiz finals
New year quiz finalsNew year quiz finals
New year quiz finals
 
Sports qz prelims
Sports qz   prelimsSports qz   prelims
Sports qz prelims
 
The next generation JPEG standards
The next generation JPEG standardsThe next generation JPEG standards
The next generation JPEG standards
 
Finals-Bollywood Quiz
Finals-Bollywood QuizFinals-Bollywood Quiz
Finals-Bollywood Quiz
 

Similar to Shoulders of giants: Languages Kotlin learned from

2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
Andrey Breslav
 
Just Kotlin
Just KotlinJust Kotlin
Feel of Kotlin (Berlin JUG 16 Apr 2015)
Feel of Kotlin (Berlin JUG 16 Apr 2015)Feel of Kotlin (Berlin JUG 16 Apr 2015)
Feel of Kotlin (Berlin JUG 16 Apr 2015)
intelliyole
 
Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016
DesertJames
 
Kotlin @ Devoxx 2011
Kotlin @ Devoxx 2011Kotlin @ Devoxx 2011
Kotlin @ Devoxx 2011
Andrey Breslav
 
Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011
Andrey Breslav
 
Crystal presentation in NY
Crystal presentation in NYCrystal presentation in NY
Crystal presentation in NY
Crystal Language
 
Let's fly to the Kotlin Island. Just an introduction to Kotlin
Let's fly to the Kotlin Island. Just an introduction to KotlinLet's fly to the Kotlin Island. Just an introduction to Kotlin
Let's fly to the Kotlin Island. Just an introduction to Kotlin
Aliaksei Zhynhiarouski
 
Kotlin 101 for Java Developers
Kotlin 101 for Java DevelopersKotlin 101 for Java Developers
Kotlin 101 for Java Developers
Christoph Pickl
 
Kotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrainsKotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrains
Jigar Gosar
 
Intro to Kotlin
Intro to KotlinIntro to Kotlin
Intro to Kotlin
Magda Miu
 
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018 Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
Codemotion
 
Scala fundamentals
Scala fundamentalsScala fundamentals
Scala fundamentals
Alfonso Ruzafa
 
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Andrés Viedma Peláez
 
Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Kotlin for Android Developers - 3
Kotlin for Android Developers - 3
Mohamed Nabil, MSc.
 
Crystal Rocks
Crystal RocksCrystal Rocks
Crystal Rocks
Brian Cardiff
 
Why Kotlin is your next language?
Why Kotlin is your next language? Why Kotlin is your next language?
Why Kotlin is your next language?
Aliaksei Zhynhiarouski
 
Kotlin coroutines and spring framework
Kotlin coroutines and spring frameworkKotlin coroutines and spring framework
Kotlin coroutines and spring framework
Sunghyouk Bae
 
KotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxKotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptx
Ian Robertson
 
Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.
James Curran
 

Similar to Shoulders of giants: Languages Kotlin learned from (20)

2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
 
Just Kotlin
Just KotlinJust Kotlin
Just Kotlin
 
Feel of Kotlin (Berlin JUG 16 Apr 2015)
Feel of Kotlin (Berlin JUG 16 Apr 2015)Feel of Kotlin (Berlin JUG 16 Apr 2015)
Feel of Kotlin (Berlin JUG 16 Apr 2015)
 
Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016Kotlin Austin Droids April 14 2016
Kotlin Austin Droids April 14 2016
 
Kotlin @ Devoxx 2011
Kotlin @ Devoxx 2011Kotlin @ Devoxx 2011
Kotlin @ Devoxx 2011
 
Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011
 
Crystal presentation in NY
Crystal presentation in NYCrystal presentation in NY
Crystal presentation in NY
 
Let's fly to the Kotlin Island. Just an introduction to Kotlin
Let's fly to the Kotlin Island. Just an introduction to KotlinLet's fly to the Kotlin Island. Just an introduction to Kotlin
Let's fly to the Kotlin Island. Just an introduction to Kotlin
 
Kotlin 101 for Java Developers
Kotlin 101 for Java DevelopersKotlin 101 for Java Developers
Kotlin 101 for Java Developers
 
Kotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrainsKotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrains
 
Intro to Kotlin
Intro to KotlinIntro to Kotlin
Intro to Kotlin
 
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018 Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
 
Scala fundamentals
Scala fundamentalsScala fundamentals
Scala fundamentals
 
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
 
Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Kotlin for Android Developers - 3
Kotlin for Android Developers - 3
 
Crystal Rocks
Crystal RocksCrystal Rocks
Crystal Rocks
 
Why Kotlin is your next language?
Why Kotlin is your next language? Why Kotlin is your next language?
Why Kotlin is your next language?
 
Kotlin coroutines and spring framework
Kotlin coroutines and spring frameworkKotlin coroutines and spring framework
Kotlin coroutines and spring framework
 
KotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxKotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptx
 
Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.
 

More from Andrey Breslav

Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?
Andrey Breslav
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in Kotlin
Andrey Breslav
 
Flexible Types in Kotlin - JVMLS 2015
Flexible Types in Kotlin - JVMLS 2015Flexible Types in Kotlin - JVMLS 2015
Flexible Types in Kotlin - JVMLS 2015
Andrey Breslav
 
Eval4j @ JVMLS 2014
Eval4j @ JVMLS 2014Eval4j @ JVMLS 2014
Eval4j @ JVMLS 2014
Andrey Breslav
 
Introduction to Kotlin: Brief and clear
Introduction to Kotlin: Brief and clearIntroduction to Kotlin: Brief and clear
Introduction to Kotlin: Brief and clear
Andrey Breslav
 
Kotlin for Android: Brief and Clear
Kotlin for Android: Brief and ClearKotlin for Android: Brief and Clear
Kotlin for Android: Brief and Clear
Andrey Breslav
 
Kotlin (Introduction for students)
Kotlin (Introduction for students)Kotlin (Introduction for students)
Kotlin (Introduction for students)
Andrey Breslav
 
Kotlin: Challenges in JVM language design
Kotlin: Challenges in JVM language designKotlin: Challenges in JVM language design
Kotlin: Challenges in JVM language design
Andrey Breslav
 
Kotlin gets Reflection
Kotlin gets ReflectionKotlin gets Reflection
Kotlin gets Reflection
Andrey Breslav
 
Language Design Trade-offs
Language Design Trade-offsLanguage Design Trade-offs
Language Design Trade-offs
Andrey Breslav
 
Functions and data
Functions and dataFunctions and data
Functions and data
Andrey Breslav
 
Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?
Andrey Breslav
 
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Andrey Breslav
 
JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
JavaOne2012: Kotlin: Practical Aspects of JVM Language ImplementationJavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
Andrey Breslav
 
[JVMLS 12] Kotlin / Java Interop
[JVMLS 12] Kotlin / Java Interop[JVMLS 12] Kotlin / Java Interop
[JVMLS 12] Kotlin / Java Interop
Andrey Breslav
 
Kotlin @ CSClub & Yandex
Kotlin @ CSClub & YandexKotlin @ CSClub & Yandex
Kotlin @ CSClub & Yandex
Andrey Breslav
 
Kotlin @ StrangeLoop 2011
Kotlin @ StrangeLoop 2011Kotlin @ StrangeLoop 2011
Kotlin @ StrangeLoop 2011
Andrey Breslav
 

More from Andrey Breslav (17)

Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in Kotlin
 
Flexible Types in Kotlin - JVMLS 2015
Flexible Types in Kotlin - JVMLS 2015Flexible Types in Kotlin - JVMLS 2015
Flexible Types in Kotlin - JVMLS 2015
 
Eval4j @ JVMLS 2014
Eval4j @ JVMLS 2014Eval4j @ JVMLS 2014
Eval4j @ JVMLS 2014
 
Introduction to Kotlin: Brief and clear
Introduction to Kotlin: Brief and clearIntroduction to Kotlin: Brief and clear
Introduction to Kotlin: Brief and clear
 
Kotlin for Android: Brief and Clear
Kotlin for Android: Brief and ClearKotlin for Android: Brief and Clear
Kotlin for Android: Brief and Clear
 
Kotlin (Introduction for students)
Kotlin (Introduction for students)Kotlin (Introduction for students)
Kotlin (Introduction for students)
 
Kotlin: Challenges in JVM language design
Kotlin: Challenges in JVM language designKotlin: Challenges in JVM language design
Kotlin: Challenges in JVM language design
 
Kotlin gets Reflection
Kotlin gets ReflectionKotlin gets Reflection
Kotlin gets Reflection
 
Language Design Trade-offs
Language Design Trade-offsLanguage Design Trade-offs
Language Design Trade-offs
 
Functions and data
Functions and dataFunctions and data
Functions and data
 
Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?
 
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?
 
JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
JavaOne2012: Kotlin: Practical Aspects of JVM Language ImplementationJavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
 
[JVMLS 12] Kotlin / Java Interop
[JVMLS 12] Kotlin / Java Interop[JVMLS 12] Kotlin / Java Interop
[JVMLS 12] Kotlin / Java Interop
 
Kotlin @ CSClub & Yandex
Kotlin @ CSClub & YandexKotlin @ CSClub & Yandex
Kotlin @ CSClub & Yandex
 
Kotlin @ StrangeLoop 2011
Kotlin @ StrangeLoop 2011Kotlin @ StrangeLoop 2011
Kotlin @ StrangeLoop 2011
 

Recently uploaded

Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
alowpalsadig
 
Upturn India Technologies - Web development company in Nashik
Upturn India Technologies - Web development company in NashikUpturn India Technologies - Web development company in Nashik
Upturn India Technologies - Web development company in Nashik
Upturn India Technologies
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
campbellclarkson
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
seospiralmantra
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
kalichargn70th171
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 

Recently uploaded (20)

Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
 
Upturn India Technologies - Web development company in Nashik
Upturn India Technologies - Web development company in NashikUpturn India Technologies - Web development company in Nashik
Upturn India Technologies - Web development company in Nashik
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 

Shoulders of giants: Languages Kotlin learned from

  • 2. Sir Isaac Newton If I have seen further it is by standing on the shoulders of Giants Letter to Robert Hooke, 1675
  • 3. Bernard of Charters [Dicebat Bernardus Carnotensis nos esse quasi] nanos gigantium humeris incidentes. XII c.
  • 4.
  • 5. Why I’m giving this talk
  • 6.
  • 7. The right question Why don’t all language designers give such talks? Every language has learned from others
  • 8. Is it morally wrong? Or maybe even illegal? “In science and in art, there are, and can be, few, if any things, which in an abstract sense are strictly new and original throughout. Every book in literature, science, and art borrows, and must necessarily borrow, and use much which was well known and used before.” Supreme Court Justice David Souter Campbell v. Acuff-Rose Music, Inc., 510 U.S. 569 (1994)
  • 9. Does it make them worse? • Is originality what really matters to you as a developer? • Put in on the scale with productivity and maintainability  • But I want to • … stand out • … be proud of my language (and its authors) • ... win arguments with fans of other languages • … write awesome software, maybe? 
  • 10. What do language designers think? • The Kotlin team had productive discussions with • Brian Goetz • Martin Odersky • Erik Meijer • Chris Lattner • … looking forward to having more!
  • 11. My ideal world • Everyone builds on top of others’ ideas • Everyone openly admits it and says thank you • Difference from academia: it’s OK to not look at some prior work 
  • 12. So, what languages has Kotlin learned from?
  • 13. From Java: classes! • One superclass • Multiple superinterfaces • No state in interfaces • Constructors (no destructors) • Nested/inner classes • Annotations • Method overloading • One root class • toString/equals/hashCode • Autoboxing • Erased generics • Runtime safety guarantees
  • 14. Leaving things out: Java • Monitor in every object • finalize() • Covariant arrays • Everything implicitly nullable • Primitive types are not classes • Mutable collection interfaces • Static vs instance methods • Raw types • …
  • 15. From Java… class C : BaseClass, I1, I2 { class Nested { ... } inner class Inner { ... } }
  • 16. From Scala, C#... class C(p: Int, val pp: I1) : B(p, pp) { internal var foo: Int set(v) { field = check(v) } override fun toString() = "..." }
  • 17. Not Kotlin class Person { private var _name: String def name = _name def name_=(aName: String) { _name = aName } }
  • 18. Not Kotlin class Person { private string _Name; public string Name { get { return _Name; } set { _Name = value } } }
  • 19. Kotlin class Person { private var _name = "..." var name: String get() = _name set(v) { _name = v } }
  • 20. Leaving things out: Interfaces vs Scala Traits • No state allowed • no fields • no constructors • Order doesn’t matter • no linearization rules • Delegation through by
  • 21. Some (more) differences… class C(d: Intf) : Intf by d { init { println(d) } fun def(x: Int = 1) { ... } fun test() { def(x = 2) } }
  • 22. And a bit more… val person = Person("Jane", "Doe") val anonymous = object : Base() { override fun foo() { ... } }
  • 23. From Scala… object Singleton : Base(foo) { val bar = ... fun baz(): String { ... } } Singleton.baz()
  • 24. Companion objects class Data private (val x: Int) { companion object { fun create(x) = Data(x) } } val data = Data.create(10)
  • 25. Companion objects class Data private (val x: Int) { companion object { @JvmStatic fun create(x) = Data(x) } } val data = Data.create(10)
  • 26. BTW: Not so great ideas • Companion objects  • Inheritance by delegation 
  • 27. From C#... class Person( val firstName: String, val lastName: String ) fun Person.fullName() { return "$firstName $lastName" }
  • 28. Not Kotlin implicit class RichPerson(p: Person) { def fullName = s"${p.firstName} ${p.lastName}" } class PersonUtil { public static string FullName(this Person p) { return $"{p.firstName} {p.lastName}" } }
  • 29. It’s Groovy time! mylist .filter { it.foo } .map { it.bar }
  • 30. Not Kotlin mylist.filter(_.foo).map(_.bar) mylist.stream() .filter((it) -> it.getFoo()) .map((it) -> it.getBar()) .collect(Collectors.toList()) mylist.Where(it => it.foo).Select(it => it.bar)
  • 31. Not Kotlin (yet…) for (it <- mylist if it.foo) yield it.bar from it in mylist where it.foo select it.bar [it.bar for it in mylist if it.foo]
  • 32. It’s Groovy time! val foo = new Foo() foo.bar() foo.baz() foo.qux() with(foo) { bar() baz() qux() }
  • 33. DSLs: Type-Safe Builders a(href = "http://my.com") { img(src = "http://my.com/icon.png") }
  • 34. Not Kotlin  10 PRINT "Welcome to Baysick Lunar Lander v0.9" 20 LET ('dist := 100) 30 LET ('v := 1) 40 LET ('fuel := 1000) 50 LET ('mass := 1000) 60 PRINT "You are drifting towards the moon."
  • 35. Not Kotlin  object Lunar extends Baysick { def main(args:Array[String]) = { 10 PRINT "Welcome to Baysick Lunar Lander v0.9" 20 LET ('dist := 100) 30 LET ('v := 1) 40 LET ('fuel := 1000) 50 LET ('mass := 1000) 60 PRINT "You are drifting towards the moon." } }
  • 36. From Scala: Data Classes data class Person( val first: String, val last: String ) { override fun equals(other: Any?): Boolean override fun hashCode(): Int override fun toString(): String fun component1() = first fun component2() = last fun copy(first: String = this.first, last: String = this.last) } val (first, last) = myPerson
  • 37. Not Kotlin val greeting = x match { case Person(f, l) => s"Hi, $f $l!" case Pet(n) => s"Hi, $n!" _ => "Not so greetable O_o" }
  • 38. From Gosu: Smart casts val greeting = when (x) { is Person -> "Hi, ${x.first} ${x.last}!" is Pet -> "Hi, ${x.name}!" else -> "Not so greetable o_O" }
  • 39. From Groovy, C#: Elvis and friends val middle = p.middleName ?: "N/A" persons.firstOrNull()?.firstName ?: "N/A" nullable!!.foo (foo as Person).bar (foo as? Person)?.bar
  • 40. Java/Scala/C#: Generics abstract class Read<out T> { abstract fun read(): T } interface Write<in T> { fun write(t: T) }
  • 41. Java/Scala/C#: Generics class RW<T>(var t: T): Read<T>, Write<T> { override fun read(): T = t override fun write(t: T) { this.t = t } } fun foo(from: RW<out T>, to: RW<in T>) { to.write(from.read()) }
  • 42. Do other languages learn from Kotlin? • I can't be 100% sure, but looks like they do • xTend • Hack • Swift • Java? • C#? • But let them speak for themselves!
  • 43. My ideal world • Everyone builds on top of others’ ideas • Everyone openly admits it and says thank you • Difference from academia: it’s OK to not look at some prior work 
  • 44. P.S. My Personal Workaround In practice, languages are often selected by passion, not reason. Much as I’d like it to be the other way around, I see no way of changing that. So, I’m trying to make Kotlin a language that is loved for a reason 

Editor's Notes

  1. https://upload.wikimedia.org/wikipedia/commons/4/4a/Library_of_Congress%2C_Rosenwald_4%2C_Bl._5r.jpg
  2. https://upload.wikimedia.org/wikipedia/commons/3/39/GodfreyKneller-IsaacNewton-1689.jpg
  3. https://upload.wikimedia.org/wikipedia/commons/3/39/GodfreyKneller-IsaacNewton-1689.jpg
  4. https://upload.wikimedia.org/wikipedia/commons/4/4a/Library_of_Congress%2C_Rosenwald_4%2C_Bl._5r.jpg
  5. https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Warsaw_Pillow_Fight_2010_%284488607206%29.jpg/1280px-Warsaw_Pillow_Fight_2010_%284488607206%29.jpg
  6. https://en.wikipedia.org/wiki/David_Souter#/media/File:DavidSouter.jpg