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

PDF
Introduction to kotlin
PDF
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
PPT
The Kotlin Programming Language
PPTX
An Overview of the Java Programming Language
PDF
Few simple-type-tricks in scala
PDF
Kotlin advanced - language reference for android developers
PDF
Kotlin Developer Starter in Android projects
PDF
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Introduction to kotlin
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
The Kotlin Programming Language
An Overview of the Java Programming Language
Few simple-type-tricks in scala
Kotlin advanced - language reference for android developers
Kotlin Developer Starter in Android projects
Value Objects, Full Throttle (to be updated for spring TC39 meetings)

What's hot (20)

PDF
Intro to Kotlin
PPTX
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
PDF
Value objects in JS - an ES7 work in progress
PDF
Web futures
PDF
Scala jargon cheatsheet
PPTX
Roslyn and C# 6.0 New Features
PDF
Scala: Object-Oriented Meets Functional, by Iulian Dragos
PDF
Extensible Operators and Literals for JavaScript
PDF
JS Responsibilities
PDF
PDF
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
PPTX
Session 4#
PPTX
PPTX
6 Programming Languages under investigation
PDF
JavaScript Foundations Day1
PPTX
Lua. The Splendors and Miseries of Game Scripting
PDF
Getting started with C++
PDF
XAML/C# to HTML/JS
PDF
Monte Carlo C++
KEY
Ceylon - the language and its tools
Intro to Kotlin
Jug trojmiasto 2014.04.24 tricky stuff in java grammar and javac
Value objects in JS - an ES7 work in progress
Web futures
Scala jargon cheatsheet
Roslyn and C# 6.0 New Features
Scala: Object-Oriented Meets Functional, by Iulian Dragos
Extensible Operators and Literals for JavaScript
JS Responsibilities
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Session 4#
6 Programming Languages under investigation
JavaScript Foundations Day1
Lua. The Splendors and Miseries of Game Scripting
Getting started with C++
XAML/C# to HTML/JS
Monte Carlo C++
Ceylon - the language and its tools
Ad

Similar to Intro to kotlin 2018 (20)

PPTX
Kotlin for android 2019
PPTX
Introduction to Kotlin Language and its application to Android platform
PDF
Is this Swift for Android? A short introduction to the Kotlin language
PDF
Kotlin: A pragmatic language by JetBrains
PPTX
Kotlin for android
PDF
Be More Productive with Kotlin
PDF
A short introduction to the Kotlin language for Java developers
PDF
Kotlin, smarter development for the jvm
PDF
Having Fun with Kotlin Android - DILo Surabaya
PDF
Kotlin: a better Java
PDF
A quick and fast intro to Kotlin
PDF
Kotlin a problem solver - gdd extended pune
PDF
Kotlin for Android Developers - 1
PDF
Kotlin what_you_need_to_know-converted event 4 with nigerians
PDF
What’s new in Kotlin?
PDF
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
PDF
From Java to Kotlin - The first month in practice
PDF
Develop your next app with kotlin @ AndroidMakersFr 2017
PDF
Android 101 - Kotlin ( Future of Android Development)
PDF
From Java to Kotlin
Kotlin for android 2019
Introduction to Kotlin Language and its application to Android platform
Is this Swift for Android? A short introduction to the Kotlin language
Kotlin: A pragmatic language by JetBrains
Kotlin for android
Be More Productive with Kotlin
A short introduction to the Kotlin language for Java developers
Kotlin, smarter development for the jvm
Having Fun with Kotlin Android - DILo Surabaya
Kotlin: a better Java
A quick and fast intro to Kotlin
Kotlin a problem solver - gdd extended pune
Kotlin for Android Developers - 1
Kotlin what_you_need_to_know-converted event 4 with nigerians
What’s new in Kotlin?
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
From Java to Kotlin - The first month in practice
Develop your next app with kotlin @ AndroidMakersFr 2017
Android 101 - Kotlin ( Future of Android Development)
From Java to Kotlin
Ad

More from Shady Selim (20)

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

Recently uploaded (20)

PDF
AI in Product Development-omnex systems
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
L1 - Introduction to python Backend.pptx
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
AI in Product Development-omnex systems
wealthsignaloriginal-com-DS-text-... (1).pdf
Digital Strategies for Manufacturing Companies
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Wondershare Filmora 15 Crack With Activation Key [2025
Adobe Illustrator 28.6 Crack My Vision of Vector Design
How Creative Agencies Leverage Project Management Software.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Navsoft: AI-Powered Business Solutions & Custom Software Development
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Design an Analysis of Algorithms I-SECS-1021-03
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
L1 - Introduction to python Backend.pptx
VVF-Customer-Presentation2025-Ver1.9.pptx
Design an Analysis of Algorithms II-SECS-1021-03
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
top salesforce developer skills in 2025.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
Odoo POS Development Services by CandidRoot Solutions
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)

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