SlideShare a Scribd company logo
1 of 25
Download to read offline
Let’s Try Kotlin!!
Try English LT! for engineers
2023-01-07(Sat)
へー/heisy(SASAKURA Hideyuki)
My Profile
● へー/heisy(SASAKURA Hideyuki)
○ Twitter : @heisy
● IT Engineer
● Likes
○ AWS
○ Java
○ Kotlin
○ DDD / TDD
○ Bouldering & Climbing
○ Drinking 🍶🍶🍶
Introduction
KotlinFest2022 on 10th Dec 2022.
I was Staff.
But…
Introduction
I don’t touch Kotlin for several years
😭
Introduction
So I’m Kotlin Lover if not much of one,
I restart Kotlin this year !!
As beginner…😓
Agenda
● Why Kotlin?
● How learn Kotlin ?
● More enjoy coding with Kotlin
Why Kotlin?
● Concise
● Safe
● Expressive
● Interoperable
● Multiplatform
Why Kotlin?: Concise
data class Employee(
val name: String,
val email: String,
val company: String
) // + automatically generated equals(), hashCode(), toString(), and copy()
object MyCompany { // A singleton
const val name: String = "MyCompany"
}
fun main() { // Function at the top level
val employee = Employee("Alice", // No `new` keyword
"alice@mycompany.com", MyCompany.name)
println(employee)
}
Why Kotlin?: Safe
fun reply(condition: Boolean): String? = // Nullability is part of Kotlin’s type system
if (condition) "I'm fine" else null
fun error(): Nothing = // Always throw an exception
throw IllegalStateException("Shouldn't be here")
fun main() {
val condition = true // Try replacing `true` with `false` and run the sample!
val message = reply(condition) // The result is nullable
// println(message.uppercase()) // This line doesn't compile
println(message?.replace("fine", "okay")) // Access a nullable value in a safe manner
if (message != null) { // If you check that the type is right,
println(message.uppercase()) // the compiler will smart-cast it for you
}
val nonNull: String = // If the null-case throws an error,
reply(condition = true) ?: error() // Kotlin can infer that the result is non-null
println(nonNull)
}
Why Kotlin?: Expressive
val map = mapOf(1 to "one", 2 to "two")
for ((k, v) in map) { // Traverse a map or a list of pairs
println("$k -> $v")
}
Why Kotlin?: Expressive
fun obtainKnowledge() = Pair("The Answer", 42) // Single-expression functions
val (description, answer) = obtainKnowledge() // Destructure into a pair of two variables
println("$description: $answer")
getText()?.let { // Apply an action to a nullable expression
sendEmailTo("alice@example.com", it) // if it’s not null
}
Why Kotlin?: Expressive
createEmptyWindow()
.apply { // Configure properties of an object
width = 300
height = 200
isVisible = true
}.also { w -> // Perform an additional operation on a call chain
showWindow(w)
}
val fixedIssue = issueById["13456"]
?.takeIf { it.status == Status.FIXED } // Use the value only if the condition is true
println(fixedIssue)
Why Kotlin?: Interoperable
Kotlin use JVM library or framework.
Call Kotlin code from Java without an issue.
Why Kotlin?: Multiplatform
Kotlin is sharing same code across Android, iOS, Web apps,
JS.
How learn Kotlin?
Kotlin learning method is blow.
● Books
● Session/Training movies
● Programing
How learn Kotlin?
Kotlin Playground is one of best tools to learn Kotlin.
How learn Kotlin?
You will find it easy to get samples from play.kotlinlang.org.
How learn Kotlin?
Kotlin has Coroutines. It's exciting!
More enjoy coding with Kotlin
We enjoy Kotlin as follows.
● Android apps
● Spring
etc…
More enjoy coding with Kotlin
Android mobile development has been Kotlin-first.
More enjoy coding with Kotlin
Spring support building web application by Kotlin.
More enjoy coding with Kotlin
Visual Studio Code support building Kotlin Web application.
So Let’s Try Kotlin !!
End
Thank you !
Have a nice Kotlin!

More Related Content

Similar to Let's Try Kotlin

Mercury: A Functional Review
Mercury: A Functional ReviewMercury: A Functional Review
Mercury: A Functional ReviewMark Cheeseman
 
Elasticsearch's aggregations & esctl in action or how i built a cli tool...
Elasticsearch's aggregations & esctl in action  or how i built a cli tool...Elasticsearch's aggregations & esctl in action  or how i built a cli tool...
Elasticsearch's aggregations & esctl in action or how i built a cli tool...FaithWestdorp
 
JavaZone 2022 - Building Kotlin DSL.pdf
JavaZone 2022 - Building Kotlin DSL.pdfJavaZone 2022 - Building Kotlin DSL.pdf
JavaZone 2022 - Building Kotlin DSL.pdfAnton Arhipov
 
Scala 3camp 2011
Scala   3camp 2011Scala   3camp 2011
Scala 3camp 2011Scalac
 
Kotlin: forse è la volta buona (Trento)
Kotlin: forse è la volta buona (Trento)Kotlin: forse è la volta buona (Trento)
Kotlin: forse è la volta buona (Trento)Davide Cerbo
 
Property based testing
Property based testingProperty based testing
Property based testingMSDEVMTL
 
Introduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demoIntroduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demoMuhammad Abdullah
 
Kotlin for Android Development
Kotlin for Android DevelopmentKotlin for Android Development
Kotlin for Android DevelopmentSpeck&Tech
 
Kotlin mufix 31 10-2019 by Ahmed Nabil(AhmedNMahran)
Kotlin mufix 31 10-2019 by Ahmed Nabil(AhmedNMahran)Kotlin mufix 31 10-2019 by Ahmed Nabil(AhmedNMahran)
Kotlin mufix 31 10-2019 by Ahmed Nabil(AhmedNMahran)Ahmed Nabil
 
JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6Solution4Future
 
Coding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinCoding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinKai Koenig
 
Be More Productive with Kotlin
Be More Productive with KotlinBe More Productive with Kotlin
Be More Productive with KotlinBrandon Wever
 
Kotlin coroutine - the next step for RxJava developer?
Kotlin coroutine - the next step for RxJava developer?Kotlin coroutine - the next step for RxJava developer?
Kotlin coroutine - the next step for RxJava developer?Artur Latoszewski
 
Having Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo SurabayaHaving Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo SurabayaDILo Surabaya
 
C# for C++ programmers
C# for C++ programmersC# for C++ programmers
C# for C++ programmersMark Whitaker
 
Kotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRreadyKotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRreadyMobileAcademy
 
The What, Why And How of ClojureScript
The What, Why And How of ClojureScriptThe What, Why And How of ClojureScript
The What, Why And How of ClojureScriptIvan Bokii
 
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018Codemotion
 

Similar to Let's Try Kotlin (20)

Mercury: A Functional Review
Mercury: A Functional ReviewMercury: A Functional Review
Mercury: A Functional Review
 
Elasticsearch's aggregations & esctl in action or how i built a cli tool...
Elasticsearch's aggregations & esctl in action  or how i built a cli tool...Elasticsearch's aggregations & esctl in action  or how i built a cli tool...
Elasticsearch's aggregations & esctl in action or how i built a cli tool...
 
JavaZone 2022 - Building Kotlin DSL.pdf
JavaZone 2022 - Building Kotlin DSL.pdfJavaZone 2022 - Building Kotlin DSL.pdf
JavaZone 2022 - Building Kotlin DSL.pdf
 
Scala 3camp 2011
Scala   3camp 2011Scala   3camp 2011
Scala 3camp 2011
 
Kotlin: forse è la volta buona (Trento)
Kotlin: forse è la volta buona (Trento)Kotlin: forse è la volta buona (Trento)
Kotlin: forse è la volta buona (Trento)
 
Property based testing
Property based testingProperty based testing
Property based testing
 
Introduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demoIntroduction to kotlin + spring boot demo
Introduction to kotlin + spring boot demo
 
Kotlin for Android Development
Kotlin for Android DevelopmentKotlin for Android Development
Kotlin for Android Development
 
Kotlin mufix 31 10-2019 by Ahmed Nabil(AhmedNMahran)
Kotlin mufix 31 10-2019 by Ahmed Nabil(AhmedNMahran)Kotlin mufix 31 10-2019 by Ahmed Nabil(AhmedNMahran)
Kotlin mufix 31 10-2019 by Ahmed Nabil(AhmedNMahran)
 
JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6
 
Coding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinCoding for Android on steroids with Kotlin
Coding for Android on steroids with Kotlin
 
C++ Programming
C++ ProgrammingC++ Programming
C++ Programming
 
Be More Productive with Kotlin
Be More Productive with KotlinBe More Productive with Kotlin
Be More Productive with Kotlin
 
Koin Quickstart
Koin QuickstartKoin Quickstart
Koin Quickstart
 
Kotlin coroutine - the next step for RxJava developer?
Kotlin coroutine - the next step for RxJava developer?Kotlin coroutine - the next step for RxJava developer?
Kotlin coroutine - the next step for RxJava developer?
 
Having Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo SurabayaHaving Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo Surabaya
 
C# for C++ programmers
C# for C++ programmersC# for C++ programmers
C# for C++ programmers
 
Kotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRreadyKotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRready
 
The What, Why And How of ClojureScript
The What, Why And How of ClojureScriptThe What, Why And How of ClojureScript
The What, Why And How of ClojureScript
 
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
 

Recently uploaded

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 

Recently uploaded (20)

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 

Let's Try Kotlin

  • 1. Let’s Try Kotlin!! Try English LT! for engineers 2023-01-07(Sat) へー/heisy(SASAKURA Hideyuki)
  • 2. My Profile ● へー/heisy(SASAKURA Hideyuki) ○ Twitter : @heisy ● IT Engineer ● Likes ○ AWS ○ Java ○ Kotlin ○ DDD / TDD ○ Bouldering & Climbing ○ Drinking 🍶🍶🍶
  • 3. Introduction KotlinFest2022 on 10th Dec 2022. I was Staff. But…
  • 4. Introduction I don’t touch Kotlin for several years 😭
  • 5. Introduction So I’m Kotlin Lover if not much of one, I restart Kotlin this year !! As beginner…😓
  • 6. Agenda ● Why Kotlin? ● How learn Kotlin ? ● More enjoy coding with Kotlin
  • 7. Why Kotlin? ● Concise ● Safe ● Expressive ● Interoperable ● Multiplatform
  • 8. Why Kotlin?: Concise data class Employee( val name: String, val email: String, val company: String ) // + automatically generated equals(), hashCode(), toString(), and copy() object MyCompany { // A singleton const val name: String = "MyCompany" } fun main() { // Function at the top level val employee = Employee("Alice", // No `new` keyword "alice@mycompany.com", MyCompany.name) println(employee) }
  • 9. Why Kotlin?: Safe fun reply(condition: Boolean): String? = // Nullability is part of Kotlin’s type system if (condition) "I'm fine" else null fun error(): Nothing = // Always throw an exception throw IllegalStateException("Shouldn't be here") fun main() { val condition = true // Try replacing `true` with `false` and run the sample! val message = reply(condition) // The result is nullable // println(message.uppercase()) // This line doesn't compile println(message?.replace("fine", "okay")) // Access a nullable value in a safe manner if (message != null) { // If you check that the type is right, println(message.uppercase()) // the compiler will smart-cast it for you } val nonNull: String = // If the null-case throws an error, reply(condition = true) ?: error() // Kotlin can infer that the result is non-null println(nonNull) }
  • 10. Why Kotlin?: Expressive val map = mapOf(1 to "one", 2 to "two") for ((k, v) in map) { // Traverse a map or a list of pairs println("$k -> $v") }
  • 11. Why Kotlin?: Expressive fun obtainKnowledge() = Pair("The Answer", 42) // Single-expression functions val (description, answer) = obtainKnowledge() // Destructure into a pair of two variables println("$description: $answer") getText()?.let { // Apply an action to a nullable expression sendEmailTo("alice@example.com", it) // if it’s not null }
  • 12. Why Kotlin?: Expressive createEmptyWindow() .apply { // Configure properties of an object width = 300 height = 200 isVisible = true }.also { w -> // Perform an additional operation on a call chain showWindow(w) } val fixedIssue = issueById["13456"] ?.takeIf { it.status == Status.FIXED } // Use the value only if the condition is true println(fixedIssue)
  • 13. Why Kotlin?: Interoperable Kotlin use JVM library or framework. Call Kotlin code from Java without an issue.
  • 14. Why Kotlin?: Multiplatform Kotlin is sharing same code across Android, iOS, Web apps, JS.
  • 15. How learn Kotlin? Kotlin learning method is blow. ● Books ● Session/Training movies ● Programing
  • 16. How learn Kotlin? Kotlin Playground is one of best tools to learn Kotlin.
  • 17. How learn Kotlin? You will find it easy to get samples from play.kotlinlang.org.
  • 18. How learn Kotlin? Kotlin has Coroutines. It's exciting!
  • 19. More enjoy coding with Kotlin We enjoy Kotlin as follows. ● Android apps ● Spring etc…
  • 20. More enjoy coding with Kotlin Android mobile development has been Kotlin-first.
  • 21. More enjoy coding with Kotlin Spring support building web application by Kotlin.
  • 22. More enjoy coding with Kotlin Visual Studio Code support building Kotlin Web application.
  • 23. So Let’s Try Kotlin !!
  • 24. End
  • 25. Thank you ! Have a nice Kotlin!