SlideShare a Scribd company logo
The State of Kotlin 2018
Prepared by Shady Selim
facebook.com/Kotlin.Cairo
+
Speaker Bio
• Official Google Speaker
• GDG Helwan Founder & Leader
• Kotlin Cairo User Group Founder
• Mentor and tester in Udacity Nanodegree
• Mobile & Web Evangelist
• Technology savvy
• Think tank
• UI/UX freak
linkedin.com/in/ShadySelim/
@dr_Shady_Selim
+
Kotlin History
• Created by Jetbrains on 2011
• Open sourced on 2012
• Reached version 1 on 2016
• Adopted by Google on 2017
+
Google announce Kotlin as 1st Class language
+
Kotlin is:
• Statically typed programming language targeting the JVM
• Support for functional and OO paradigms
• Pragmatic, safe, concise, great Java interop
• Free and open-source
• Drastically reduces the amount of boilerplate code
• Having Lambda expression
• Avoids entire classes of errors such as null pointer exceptions
• Supported by Google
+
Kotlin Strengths
• Modeling the data of your application concisely and expressively
• Creating reusable abstractions using functional programming
techniques
• Creating expressive domain-specific languages (DSL)
• Java interop ensures that all existing Java frameworks can be used
• No rewrite required to start using Kotlin in existing codebase
• Existing investment is fully preserved
+
Kotlin Strengths
+
• Extensions
• Anko (Commons, Layouts, SQLite, & Coroutines)
• No new
• No semi colon
• Smart casting
• Great IDE and tooling supports
• Variables (val vs. var)
• Functional and OOP paradigm
Java Model Class Example
+
Java Model Class Example, cont.
+
Java Model Class Example, cont.
+
Kotlin Model Class Example
+
Kotlin Data Class
+
• Provides a Customer class with the following functionality:
• getters (and setters in case of vars) for all properties
• equals()
• hashCode()
• toString()
• copy()
• component1(), component2(), …, for all properties (see Data classes)
String Interpolation
+
println("Name $name")
Switch Case (aka: Instance Checks)
+
when (x) {
is Foo -> ...
is Bar -> ...
else -> ...
}
For Loop (aka: Ranges)
+
for (i in 1..100) { ... } // closed range: includes 100
for (i in 1 until 100) { ... } // half-open range: does not include 100
for (x in 2..10 step 2) { ... }
for (x in 10 downTo 1) { ... }
if (x in 1..10) { ... }
String Interpolation
+
val positives = list.filter { x -> x > 0 }
Filtering a list
Filtering a list
val positives = list.filter { it > 0 }
Extension Functions
+
fun String.spaceToCamelCase() { ... }
"Convert this to camelcase".spaceToCamelCase()
If not null shorthand
+
val files = File("Test").listFiles()
println(files?.size)
What if want to not accept null and throw exception in case of Null?
println(files!!.size)
If not null and else shorthand
+
val files = File("Test").listFiles()
println(files?.size ?: "empty")
Executing a statement if null
val values = ...
val email = values["email"] ?: throw IllegalStateException("Email is missing!")
Calling multiple methods on an object
+
class Turtle {
fun penDown()
fun penUp()
fun turn(degrees: Double)
fun forward(pixels: Double)
}
val myTurtle = Turtle()
with(myTurtle) { //draw a 100 pix square
penDown()
for(i in 1..4) {
forward(100.0)
turn(90.0)
}
penUp()
}
What's new in Android (Google I/O '18)
+
youtube.com/watch?v=eMHsnvhcf78&list=PLVVyfDfMc59tyEmN_V1Gv9imR8Ujld1MW&index=4
min 7 , sec 22
Modern Android development: Android Jetpack,
Kotlin, and more (Google I/O 2018)
+
youtube.com/watch?v=IrMw7MEgADk&list=PLVVyfDfMc59tyEmN_V1Gv9imR8Ujld1MW&index=9
min 16 , sec 12
Android KTX
+
A set of Kotlin extensions for Android app development. The
goal of Android KTX is to make Android development with
Kotlin more concise, pleasant, and idiomatic by leveraging
the features of the language such as extension
functions/properties, lambdas, named parameters, and
parameter defaults. It is an explicit goal of this project to not
add any new features to the existing Android APIs.
github.com/android/android-ktx/
Android KTX – cont.
+
view.viewTreeObserver.addOnPreDrawListener(
object : ViewTreeObserver.OnPreDrawListener {
override fun onPreDraw(): Boolean {
viewTreeObserver.removeOnPreDrawListener(this)
actionToBeTriggered()
return true
}
})
Kotlin:
view.doOnPreDraw { actionToBeTriggered() }
Kotlin with Android KTX:
How to learn Kotlin? (1)
+
How to learn Kotlin? (2)
+
try.kotlinlang.org/#/Kotlin%20Koans/Introduction/Hello,%20world!/Task.kt
How to learn Kotlin? (3)
+
https://eg.udacity.com/course/kotlin-bootcamp-for-programmers--ud9011
How to learn Kotlin? (4)
+
caster.io/lessons/android-mvvm-pattern-introduction-to-mvvm-for-android-with-data-binding
Try Kotlin Sandbox
+
https://kotlin.link/
+
Thank You
+

More Related Content

What's hot (20)

PDF
Intro to Kotlin
Magda Miu
 
PPTX
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Anna Brzezińska
 
PDF
Value objects in JS - an ES7 work in progress
Brendan Eich
 
PDF
Web futures
Brendan Eich
 
PDF
Scala jargon cheatsheet
Ruslan Shevchenko
 
PPTX
Roslyn and C# 6.0 New Features
Michael Step
 
PDF
Scala: Object-Oriented Meets Functional, by Iulian Dragos
3Pillar Global
 
PDF
Extensible Operators and Literals for JavaScript
Brendan Eich
 
PDF
JS Responsibilities
Brendan Eich
 
PDF
Int64
Brendan Eich
 
PDF
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
GeeksLab Odessa
 
PPTX
Session 4#
Mohamed Samir
 
PPTX
Kotlin
YeldosTanikin
 
PPTX
6 Programming Languages under investigation
Hosam Aly
 
PDF
JavaScript Foundations Day1
Troy Miles
 
PPTX
Lua. The Splendors and Miseries of Game Scripting
DevGAMM Conference
 
PDF
Getting started with C++
Michael Redlich
 
PDF
XAML/C# to HTML/JS
Michael Haberman
 
PDF
Monte Carlo C++
Dmitri Nesteruk
 
KEY
Ceylon - the language and its tools
Max Andersen
 
Intro to Kotlin
Magda Miu
 
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Anna Brzezińska
 
Value objects in JS - an ES7 work in progress
Brendan Eich
 
Web futures
Brendan Eich
 
Scala jargon cheatsheet
Ruslan Shevchenko
 
Roslyn and C# 6.0 New Features
Michael Step
 
Scala: Object-Oriented Meets Functional, by Iulian Dragos
3Pillar Global
 
Extensible Operators and Literals for JavaScript
Brendan Eich
 
JS Responsibilities
Brendan Eich
 
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
GeeksLab Odessa
 
Session 4#
Mohamed Samir
 
6 Programming Languages under investigation
Hosam Aly
 
JavaScript Foundations Day1
Troy Miles
 
Lua. The Splendors and Miseries of Game Scripting
DevGAMM Conference
 
Getting started with C++
Michael Redlich
 
XAML/C# to HTML/JS
Michael Haberman
 
Monte Carlo C++
Dmitri Nesteruk
 
Ceylon - the language and its tools
Max Andersen
 

Similar to Intro to kotlin 2018 (20)

PPTX
Kotlin for android 2019
Shady Selim
 
PPTX
Introduction to Kotlin Language and its application to Android platform
EastBanc Tachnologies
 
PDF
Is this Swift for Android? A short introduction to the Kotlin language
Antonis Lilis
 
PDF
Kotlin: A pragmatic language by JetBrains
Jigar Gosar
 
PPTX
Kotlin for android
Shady Selim
 
PDF
Be More Productive with Kotlin
Brandon Wever
 
PDF
A short introduction to the Kotlin language for Java developers
Antonis Lilis
 
PDF
Kotlin, smarter development for the jvm
Arnaud Giuliani
 
PDF
Having Fun with Kotlin Android - DILo Surabaya
DILo Surabaya
 
PDF
Kotlin: a better Java
Nils Breunese
 
PDF
A quick and fast intro to Kotlin
XPeppers
 
PDF
Kotlin a problem solver - gdd extended pune
Hardik Trivedi
 
PDF
Kotlin for Android Developers - 1
Mohamed Nabil, MSc.
 
PDF
Kotlin what_you_need_to_know-converted event 4 with nigerians
junaidhasan17
 
PDF
What’s new in Kotlin?
Squareboat
 
PDF
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PDF
From Java to Kotlin - The first month in practice
StefanTomm
 
PDF
Develop your next app with kotlin @ AndroidMakersFr 2017
Arnaud Giuliani
 
PDF
Android 101 - Kotlin ( Future of Android Development)
Hassan Abid
 
PDF
From Java to Kotlin
João Ferrão
 
Kotlin for android 2019
Shady Selim
 
Introduction to Kotlin Language and its application to Android platform
EastBanc Tachnologies
 
Is this Swift for Android? A short introduction to the Kotlin language
Antonis Lilis
 
Kotlin: A pragmatic language by JetBrains
Jigar Gosar
 
Kotlin for android
Shady Selim
 
Be More Productive with Kotlin
Brandon Wever
 
A short introduction to the Kotlin language for Java developers
Antonis Lilis
 
Kotlin, smarter development for the jvm
Arnaud Giuliani
 
Having Fun with Kotlin Android - DILo Surabaya
DILo Surabaya
 
Kotlin: a better Java
Nils Breunese
 
A quick and fast intro to Kotlin
XPeppers
 
Kotlin a problem solver - gdd extended pune
Hardik Trivedi
 
Kotlin for Android Developers - 1
Mohamed Nabil, MSc.
 
Kotlin what_you_need_to_know-converted event 4 with nigerians
junaidhasan17
 
What’s new in Kotlin?
Squareboat
 
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
From Java to Kotlin - The first month in practice
StefanTomm
 
Develop your next app with kotlin @ AndroidMakersFr 2017
Arnaud Giuliani
 
Android 101 - Kotlin ( Future of Android Development)
Hassan Abid
 
From Java to Kotlin
João Ferrão
 
Ad

More from Shady Selim (20)

PPTX
What is Kotlin Multiplaform? Why & How?
Shady Selim
 
PDF
Kotlin native for iOS and Android
Shady Selim
 
PPTX
Introduction on Mobile development
Shady Selim
 
PDF
Game development using Flutter
Shady Selim
 
PPTX
I/O 2019 android updates
Shady Selim
 
PPTX
What's new in android 2018 (dev fest)
Shady Selim
 
PPTX
Intro to Flutter
Shady Selim
 
PDF
The magic of flutter
Shady Selim
 
PPTX
Intro to Kotlin
Shady Selim
 
PPTX
Intro to Kotlin Minia GDG DevFest 2017
Shady Selim
 
PPTX
Kotlin for Frontend & Backend Web development
Shady Selim
 
PPTX
Intro to Kotlin
Shady Selim
 
PPTX
Firebase
Shady Selim
 
PPTX
Android content provider explained
Shady Selim
 
PPTX
Design for Web and Mobile
Shady Selim
 
PPTX
Towards a better higher education system by Shady Selim
Shady Selim
 
DOCX
Android Programing Course Material Labs
Shady Selim
 
DOCX
Android Programing Course Material
Shady Selim
 
PPTX
Cross mobility
Shady Selim
 
PPTX
Mobile apps types + Responsice Vs. Adaptive
Shady Selim
 
What is Kotlin Multiplaform? Why & How?
Shady Selim
 
Kotlin native for iOS and Android
Shady Selim
 
Introduction on Mobile development
Shady Selim
 
Game development using Flutter
Shady Selim
 
I/O 2019 android updates
Shady Selim
 
What's new in android 2018 (dev fest)
Shady Selim
 
Intro to Flutter
Shady Selim
 
The magic of flutter
Shady Selim
 
Intro to Kotlin
Shady Selim
 
Intro to Kotlin Minia GDG DevFest 2017
Shady Selim
 
Kotlin for Frontend & Backend Web development
Shady Selim
 
Intro to Kotlin
Shady Selim
 
Firebase
Shady Selim
 
Android content provider explained
Shady Selim
 
Design for Web and Mobile
Shady Selim
 
Towards a better higher education system by Shady Selim
Shady Selim
 
Android Programing Course Material Labs
Shady Selim
 
Android Programing Course Material
Shady Selim
 
Cross mobility
Shady Selim
 
Mobile apps types + Responsice Vs. Adaptive
Shady Selim
 
Ad

Recently uploaded (20)

PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 

Intro to kotlin 2018

  • 1. The State of Kotlin 2018 Prepared by Shady Selim facebook.com/Kotlin.Cairo +
  • 2. Speaker Bio • Official Google Speaker • GDG Helwan Founder & Leader • Kotlin Cairo User Group Founder • Mentor and tester in Udacity Nanodegree • Mobile & Web Evangelist • Technology savvy • Think tank • UI/UX freak linkedin.com/in/ShadySelim/ @dr_Shady_Selim +
  • 3. Kotlin History • Created by Jetbrains on 2011 • Open sourced on 2012 • Reached version 1 on 2016 • Adopted by Google on 2017 +
  • 4. Google announce Kotlin as 1st Class language +
  • 5. Kotlin is: • Statically typed programming language targeting the JVM • Support for functional and OO paradigms • Pragmatic, safe, concise, great Java interop • Free and open-source • Drastically reduces the amount of boilerplate code • Having Lambda expression • Avoids entire classes of errors such as null pointer exceptions • Supported by Google +
  • 6. Kotlin Strengths • Modeling the data of your application concisely and expressively • Creating reusable abstractions using functional programming techniques • Creating expressive domain-specific languages (DSL) • Java interop ensures that all existing Java frameworks can be used • No rewrite required to start using Kotlin in existing codebase • Existing investment is fully preserved +
  • 7. Kotlin Strengths + • Extensions • Anko (Commons, Layouts, SQLite, & Coroutines) • No new • No semi colon • Smart casting • Great IDE and tooling supports • Variables (val vs. var) • Functional and OOP paradigm
  • 8. Java Model Class Example +
  • 9. Java Model Class Example, cont. +
  • 10. Java Model Class Example, cont. +
  • 11. Kotlin Model Class Example +
  • 12. Kotlin Data Class + • Provides a Customer class with the following functionality: • getters (and setters in case of vars) for all properties • equals() • hashCode() • toString() • copy() • component1(), component2(), …, for all properties (see Data classes)
  • 14. Switch Case (aka: Instance Checks) + when (x) { is Foo -> ... is Bar -> ... else -> ... }
  • 15. For Loop (aka: Ranges) + for (i in 1..100) { ... } // closed range: includes 100 for (i in 1 until 100) { ... } // half-open range: does not include 100 for (x in 2..10 step 2) { ... } for (x in 10 downTo 1) { ... } if (x in 1..10) { ... }
  • 16. String Interpolation + val positives = list.filter { x -> x > 0 } Filtering a list Filtering a list val positives = list.filter { it > 0 }
  • 17. Extension Functions + fun String.spaceToCamelCase() { ... } "Convert this to camelcase".spaceToCamelCase()
  • 18. If not null shorthand + val files = File("Test").listFiles() println(files?.size) What if want to not accept null and throw exception in case of Null? println(files!!.size)
  • 19. If not null and else shorthand + val files = File("Test").listFiles() println(files?.size ?: "empty") Executing a statement if null val values = ... val email = values["email"] ?: throw IllegalStateException("Email is missing!")
  • 20. Calling multiple methods on an object + class Turtle { fun penDown() fun penUp() fun turn(degrees: Double) fun forward(pixels: Double) } val myTurtle = Turtle() with(myTurtle) { //draw a 100 pix square penDown() for(i in 1..4) { forward(100.0) turn(90.0) } penUp() }
  • 21. What's new in Android (Google I/O '18) + youtube.com/watch?v=eMHsnvhcf78&list=PLVVyfDfMc59tyEmN_V1Gv9imR8Ujld1MW&index=4 min 7 , sec 22
  • 22. Modern Android development: Android Jetpack, Kotlin, and more (Google I/O 2018) + youtube.com/watch?v=IrMw7MEgADk&list=PLVVyfDfMc59tyEmN_V1Gv9imR8Ujld1MW&index=9 min 16 , sec 12
  • 23. Android KTX + A set of Kotlin extensions for Android app development. The goal of Android KTX is to make Android development with Kotlin more concise, pleasant, and idiomatic by leveraging the features of the language such as extension functions/properties, lambdas, named parameters, and parameter defaults. It is an explicit goal of this project to not add any new features to the existing Android APIs. github.com/android/android-ktx/
  • 24. Android KTX – cont. + view.viewTreeObserver.addOnPreDrawListener( object : ViewTreeObserver.OnPreDrawListener { override fun onPreDraw(): Boolean { viewTreeObserver.removeOnPreDrawListener(this) actionToBeTriggered() return true } }) Kotlin: view.doOnPreDraw { actionToBeTriggered() } Kotlin with Android KTX:
  • 25. How to learn Kotlin? (1) +
  • 26. How to learn Kotlin? (2) + try.kotlinlang.org/#/Kotlin%20Koans/Introduction/Hello,%20world!/Task.kt
  • 27. How to learn Kotlin? (3) + https://eg.udacity.com/course/kotlin-bootcamp-for-programmers--ud9011
  • 28. How to learn Kotlin? (4) + caster.io/lessons/android-mvvm-pattern-introduction-to-mvvm-for-android-with-data-binding