SlideShare a Scribd company logo
Kotlin
A modern language for modern times
About me
My name is Sergi
20 years playing with computers
I work at
I add bugs to the Android app
We use Kotlin, and we love it!
What is Kotlin?
A language created by JetBrains
Three flavors
Kotlin/JVM
Kotlin/Native (beta)
Kotlin/Javascript
Variables
var name = "John"
var surname: String = "Doe"
var address: Location = Location("my house")
name = "Mike"
surname = "Magic"
address = Location("my other house")
val age = 32
age += 1 //Error: is val
Nullability
var title: String = "Jaws"
title = null //Error: not nullable
var title: String? = "E.T."
genre = null //Fine, name is nullable
Java
String lowercase = null
if (uppercase != null) {
lowercase = uppercase.toLowerCase()
}
Kotlin
var lowercase: String? = null
lowercase = uppercase?.toLowerCase()
Java
if (session.getLoggedCandidate() != null) {
...do a lot of stuff
}
Kotlin
session.loggedCandidate?.let {
...do a lot of stuff
}
Functions & classes
class Person (
val name: String,
val surName: String,
var age: Int,
val address: Address?
) {
val fullName = "$name $surName"
fun grow(years: Int = 1) {
age += years
}
fun getNationality() = address?.country
}
data class Person(
val name: String,
val surName: String,
var age: Int,
val address: Address?
)
fun brother(person:Person, brotherName: String) =
person.copy(name = brotherName)
Lambdas & function type
Java
public interface Callback {
void onFinish(String result);
}
public void operation(Callback callback) {
//perform operation
callback.onFinish(result);
}
operation(new Callback() {
@Override
public void onFinish(String result) {
//Do finishing stuff
}
});
Kotlin
fun operation(callback: (String) -> Unit) {
//perform operation
callback("")
}
operation { result ->
//finish it
}
Streams
Java 7
List<Person> grow(List<Person> persons) {
for (Person person : persons) {
person.setAge(person.getAge()+1);
}
}
Java 8
List<Person> grow(List<Person> persons) {
return persons.stream()
.map (person -> person.setAge(person.getAge()+1))
.toList()
}
Kotlin
fun grow(persons: List<Person>) = persons.map { it.age +1 }
Real case
Transform this:
"(JAVA OR J2EE OR JAVA2E OR JAVA2EE OR JEE) AND (DESARROLLADOR OR DEVELOPER OR PROGRAMADOR OR PROGRAMMER) AND (SISTEMAS OR
SISTEMES)",
"java or j2ee",
"Java",
"Android",
"(JAVA OR J2EE OR JAVA2EE OR JEE OR JAVA2E) AND (PROGRAMADOR OR PROGRAMMER OR DEVELOPER OR DESARROLLADOR)"
Into this:
"java", "J2EE", "JAVA2E", "JAVA2EE", "JEE", "DESARROLLADOR", "DEVELOPER", "PROGRAMADOR", "PROGRAMMER", "SISTEMAS", “SISTEMES",
"android"
private fun mapKeywords(keywords: List<String>) = keywords
.map { it.split(Regex("( AND )|( OR )|(|)| |,|¿|"|'")) }
.flatten()
.filter { it.isNotBlank() }
.distinctBy { it.toLowerCase() }
And much more!
(but we are out of time)
More info
https://kotlinlang.org
https://jetbrains.com
https://play.kotlinlang.org/koans (Kotlin Koans)
https://antonioleiva.com/ (buy his book!)
If you have any question: @sergiandreplace
(and I’ll be around the hackathon)

More Related Content

What's hot

Kotlin : Happy Development
Kotlin : Happy DevelopmentKotlin : Happy Development
Kotlin : Happy Development
Md Sazzad Islam
 
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwiftSwift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
Aaron Douglas
 
What JS? Itself
What JS? ItselfWhat JS? Itself
What JS? Itself
Lucio Martinez
 
JavaScriptとLisp
JavaScriptとLispJavaScriptとLisp
JavaScriptとLisp
taiju higashi
 
Functional Reactive Programming without Black Magic (UIKonf 2015)
Functional Reactive Programming without Black Magic (UIKonf 2015)Functional Reactive Programming without Black Magic (UIKonf 2015)
Functional Reactive Programming without Black Magic (UIKonf 2015)
Jens Ravens
 
Telegram bots
Telegram botsTelegram bots
Telegram bots
Andrii Sierkov
 
Alessandro (cirpo) Cinelli - Dear JavaScript - Codemotion Berlin 2018
Alessandro (cirpo) Cinelli - Dear JavaScript - Codemotion Berlin 2018Alessandro (cirpo) Cinelli - Dear JavaScript - Codemotion Berlin 2018
Alessandro (cirpo) Cinelli - Dear JavaScript - Codemotion Berlin 2018
Codemotion
 
Stetl for INSPIRE Data Transformation
Stetl for INSPIRE Data TransformationStetl for INSPIRE Data Transformation
Stetl for INSPIRE Data Transformation
Just van den Broecke
 
Geospatial ETL with Stetl - GeoPython 2016
Geospatial ETL with Stetl - GeoPython 2016Geospatial ETL with Stetl - GeoPython 2016
Geospatial ETL with Stetl - GeoPython 2016
Just van den Broecke
 
Taming Rich GML with Stetl - FOSS4G 2013 Nottingham
Taming Rich GML with Stetl - FOSS4G 2013 NottinghamTaming Rich GML with Stetl - FOSS4G 2013 Nottingham
Taming Rich GML with Stetl - FOSS4G 2013 Nottingham
Just van den Broecke
 
5 Minute Intro to Stetl
5 Minute Intro to Stetl5 Minute Intro to Stetl
5 Minute Intro to Stetl
Just van den Broecke
 
Go for Rubyists
Go for RubyistsGo for Rubyists
Go for Rubyists
Luka Zakrajšek
 
Functional programming in javascript
Functional programming in javascriptFunctional programming in javascript
Functional programming in javascript
Boris Burdiliak
 
Reactive Programming with RxSwift
Reactive Programming with RxSwiftReactive Programming with RxSwift
Reactive Programming with RxSwift
Scott Gardner
 
Boost your productivity with Clojure REPL
Boost your productivity with Clojure REPLBoost your productivity with Clojure REPL
Boost your productivity with Clojure REPL
Kent Ohashi
 
Groovy
GroovyGroovy
Groovy
atonse
 
Reactive programming with RxSwift
Reactive programming with RxSwiftReactive programming with RxSwift
Reactive programming with RxSwift
Scott Gardner
 
Streams of information - Chicago crystal language monthly meetup
Streams of information - Chicago crystal language monthly meetupStreams of information - Chicago crystal language monthly meetup
Streams of information - Chicago crystal language monthly meetup
Brian Cardiff
 
[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...
[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...
[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...
DevDay Da Nang
 

What's hot (19)

Kotlin : Happy Development
Kotlin : Happy DevelopmentKotlin : Happy Development
Kotlin : Happy Development
 
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwiftSwift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
Swift & ReactiveX – Asynchronous Event-Based Funsies with RxSwift
 
What JS? Itself
What JS? ItselfWhat JS? Itself
What JS? Itself
 
JavaScriptとLisp
JavaScriptとLispJavaScriptとLisp
JavaScriptとLisp
 
Functional Reactive Programming without Black Magic (UIKonf 2015)
Functional Reactive Programming without Black Magic (UIKonf 2015)Functional Reactive Programming without Black Magic (UIKonf 2015)
Functional Reactive Programming without Black Magic (UIKonf 2015)
 
Telegram bots
Telegram botsTelegram bots
Telegram bots
 
Alessandro (cirpo) Cinelli - Dear JavaScript - Codemotion Berlin 2018
Alessandro (cirpo) Cinelli - Dear JavaScript - Codemotion Berlin 2018Alessandro (cirpo) Cinelli - Dear JavaScript - Codemotion Berlin 2018
Alessandro (cirpo) Cinelli - Dear JavaScript - Codemotion Berlin 2018
 
Stetl for INSPIRE Data Transformation
Stetl for INSPIRE Data TransformationStetl for INSPIRE Data Transformation
Stetl for INSPIRE Data Transformation
 
Geospatial ETL with Stetl - GeoPython 2016
Geospatial ETL with Stetl - GeoPython 2016Geospatial ETL with Stetl - GeoPython 2016
Geospatial ETL with Stetl - GeoPython 2016
 
Taming Rich GML with Stetl - FOSS4G 2013 Nottingham
Taming Rich GML with Stetl - FOSS4G 2013 NottinghamTaming Rich GML with Stetl - FOSS4G 2013 Nottingham
Taming Rich GML with Stetl - FOSS4G 2013 Nottingham
 
5 Minute Intro to Stetl
5 Minute Intro to Stetl5 Minute Intro to Stetl
5 Minute Intro to Stetl
 
Go for Rubyists
Go for RubyistsGo for Rubyists
Go for Rubyists
 
Functional programming in javascript
Functional programming in javascriptFunctional programming in javascript
Functional programming in javascript
 
Reactive Programming with RxSwift
Reactive Programming with RxSwiftReactive Programming with RxSwift
Reactive Programming with RxSwift
 
Boost your productivity with Clojure REPL
Boost your productivity with Clojure REPLBoost your productivity with Clojure REPL
Boost your productivity with Clojure REPL
 
Groovy
GroovyGroovy
Groovy
 
Reactive programming with RxSwift
Reactive programming with RxSwiftReactive programming with RxSwift
Reactive programming with RxSwift
 
Streams of information - Chicago crystal language monthly meetup
Streams of information - Chicago crystal language monthly meetupStreams of information - Chicago crystal language monthly meetup
Streams of information - Chicago crystal language monthly meetup
 
[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...
[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...
[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...
 

Similar to Kotlin, a modern language for modern times

Introduction kot iin
Introduction kot iinIntroduction kot iin
Introduction kot iin
Jedsada Tiwongvokul
 
Kotlin – the future of android
Kotlin – the future of androidKotlin – the future of android
Kotlin – the future of android
DJ Rausch
 
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
 
Be More Productive with Kotlin
Be More Productive with KotlinBe More Productive with Kotlin
Be More Productive with Kotlin
Brandon Wever
 
Kotlin/Everywhere GDG Bhubaneswar 2019
Kotlin/Everywhere GDG Bhubaneswar 2019 Kotlin/Everywhere GDG Bhubaneswar 2019
Kotlin/Everywhere GDG Bhubaneswar 2019
Sriyank Siddhartha
 
Kotlin Overview (PT-BR)
Kotlin Overview (PT-BR)Kotlin Overview (PT-BR)
Kotlin Overview (PT-BR)
ThomasHorta
 
Kotlin intro
Kotlin introKotlin intro
Kotlin intro
Elifarley Cruz
 
Kotlin on android
Kotlin on androidKotlin on android
Kotlin on android
Kurt Renzo Acosta
 
Kotlin Generation
Kotlin GenerationKotlin Generation
Kotlin Generation
Minseo Chayabanjonglerd
 
No excuses, switch to kotlin
No excuses, switch to kotlinNo excuses, switch to kotlin
No excuses, switch to kotlin
Thijs Suijten
 
Intro to scala
Intro to scalaIntro to scala
Intro to scala
Joe Zulli
 
Kotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparisonKotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparison
Ed Austin
 
Kotlin for android
Kotlin for androidKotlin for android
Kotlin for android
Ahmed Nabil
 
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
 
Kotlin L → ∞
Kotlin L → ∞Kotlin L → ∞
Kotlin L → ∞
Abdellah SELASSI
 
Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)
Cody Engel
 
Bologna Developer Zone - About Kotlin
Bologna Developer Zone - About KotlinBologna Developer Zone - About Kotlin
Bologna Developer Zone - About Kotlin
Marco Vasapollo
 
Pooya Khaloo Presentation on IWMC 2015
Pooya Khaloo Presentation on IWMC 2015Pooya Khaloo Presentation on IWMC 2015
Pooya Khaloo Presentation on IWMC 2015
Iran Entrepreneurship Association
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
Giordano Scalzo
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
HamletDRC
 

Similar to Kotlin, a modern language for modern times (20)

Introduction kot iin
Introduction kot iinIntroduction kot iin
Introduction kot iin
 
Kotlin – the future of android
Kotlin – the future of androidKotlin – the future of android
Kotlin – the future of android
 
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
 
Be More Productive with Kotlin
Be More Productive with KotlinBe More Productive with Kotlin
Be More Productive with Kotlin
 
Kotlin/Everywhere GDG Bhubaneswar 2019
Kotlin/Everywhere GDG Bhubaneswar 2019 Kotlin/Everywhere GDG Bhubaneswar 2019
Kotlin/Everywhere GDG Bhubaneswar 2019
 
Kotlin Overview (PT-BR)
Kotlin Overview (PT-BR)Kotlin Overview (PT-BR)
Kotlin Overview (PT-BR)
 
Kotlin intro
Kotlin introKotlin intro
Kotlin intro
 
Kotlin on android
Kotlin on androidKotlin on android
Kotlin on android
 
Kotlin Generation
Kotlin GenerationKotlin Generation
Kotlin Generation
 
No excuses, switch to kotlin
No excuses, switch to kotlinNo excuses, switch to kotlin
No excuses, switch to kotlin
 
Intro to scala
Intro to scalaIntro to scala
Intro to scala
 
Kotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparisonKotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparison
 
Kotlin for android
Kotlin for androidKotlin for android
Kotlin for android
 
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)
 
Kotlin L → ∞
Kotlin L → ∞Kotlin L → ∞
Kotlin L → ∞
 
Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)
 
Bologna Developer Zone - About Kotlin
Bologna Developer Zone - About KotlinBologna Developer Zone - About Kotlin
Bologna Developer Zone - About Kotlin
 
Pooya Khaloo Presentation on IWMC 2015
Pooya Khaloo Presentation on IWMC 2015Pooya Khaloo Presentation on IWMC 2015
Pooya Khaloo Presentation on IWMC 2015
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
 

More from Sergi Martínez

What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?
Sergi Martínez
 
What is flutter and why should i care? Lightning talk
What is flutter and why should i care? Lightning talkWhat is flutter and why should i care? Lightning talk
What is flutter and why should i care? Lightning talk
Sergi Martínez
 
Let’s talk about star wars with Dialog Flow
Let’s talk about star wars with Dialog FlowLet’s talk about star wars with Dialog Flow
Let’s talk about star wars with Dialog Flow
Sergi Martínez
 
Database handling with room
Database handling with roomDatabase handling with room
Database handling with room
Sergi Martínez
 
Realm or: How I learned to stop worrying and love my app database
Realm or: How I learned to stop worrying and love my app databaseRealm or: How I learned to stop worrying and love my app database
Realm or: How I learned to stop worrying and love my app database
Sergi Martínez
 
Android data binding
Android data bindingAndroid data binding
Android data binding
Sergi Martínez
 
It's the arts! Playing around with the Android canvas
It's the arts! Playing around with the Android canvasIt's the arts! Playing around with the Android canvas
It's the arts! Playing around with the Android canvas
Sergi Martínez
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android Fragments
Sergi Martínez
 
Android master class
Android master classAndroid master class
Android master class
Sergi Martínez
 
Creating multillingual apps for android
Creating multillingual apps for androidCreating multillingual apps for android
Creating multillingual apps for android
Sergi Martínez
 
Píldoras android i. Intro - 2ª parte
Píldoras android i. Intro - 2ª partePíldoras android i. Intro - 2ª parte
Píldoras android i. Intro - 2ª parte
Sergi Martínez
 
Introducción a mobclix
Introducción a mobclixIntroducción a mobclix
Introducción a mobclix
Sergi Martínez
 
Admob y yo
Admob y yoAdmob y yo
Admob y yo
Sergi Martínez
 

More from Sergi Martínez (14)

What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?
 
What is flutter and why should i care? Lightning talk
What is flutter and why should i care? Lightning talkWhat is flutter and why should i care? Lightning talk
What is flutter and why should i care? Lightning talk
 
Let’s talk about star wars with Dialog Flow
Let’s talk about star wars with Dialog FlowLet’s talk about star wars with Dialog Flow
Let’s talk about star wars with Dialog Flow
 
Database handling with room
Database handling with roomDatabase handling with room
Database handling with room
 
Realm or: How I learned to stop worrying and love my app database
Realm or: How I learned to stop worrying and love my app databaseRealm or: How I learned to stop worrying and love my app database
Realm or: How I learned to stop worrying and love my app database
 
Android data binding
Android data bindingAndroid data binding
Android data binding
 
It's the arts! Playing around with the Android canvas
It's the arts! Playing around with the Android canvasIt's the arts! Playing around with the Android canvas
It's the arts! Playing around with the Android canvas
 
Smartphones
SmartphonesSmartphones
Smartphones
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android Fragments
 
Android master class
Android master classAndroid master class
Android master class
 
Creating multillingual apps for android
Creating multillingual apps for androidCreating multillingual apps for android
Creating multillingual apps for android
 
Píldoras android i. Intro - 2ª parte
Píldoras android i. Intro - 2ª partePíldoras android i. Intro - 2ª parte
Píldoras android i. Intro - 2ª parte
 
Introducción a mobclix
Introducción a mobclixIntroducción a mobclix
Introducción a mobclix
 
Admob y yo
Admob y yoAdmob y yo
Admob y yo
 

Recently uploaded

How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
narinav14
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
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.
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
What’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete RoadmapWhat’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete Roadmap
Envertis Software Solutions
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 
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
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
seospiralmantra
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
Tier1 app
 
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
 
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
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
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
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
🏎️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
 

Recently uploaded (20)

How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
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
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
What’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete RoadmapWhat’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete Roadmap
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 
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...
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
 
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
 
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
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
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
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
🏎️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 👩‍💻
 

Kotlin, a modern language for modern times

  • 1. Kotlin A modern language for modern times
  • 2. About me My name is Sergi 20 years playing with computers I work at I add bugs to the Android app We use Kotlin, and we love it!
  • 4. A language created by JetBrains
  • 10. var name = "John" var surname: String = "Doe" var address: Location = Location("my house") name = "Mike" surname = "Magic" address = Location("my other house") val age = 32 age += 1 //Error: is val
  • 12. var title: String = "Jaws" title = null //Error: not nullable var title: String? = "E.T." genre = null //Fine, name is nullable
  • 13. Java String lowercase = null if (uppercase != null) { lowercase = uppercase.toLowerCase() } Kotlin var lowercase: String? = null lowercase = uppercase?.toLowerCase()
  • 14. Java if (session.getLoggedCandidate() != null) { ...do a lot of stuff } Kotlin session.loggedCandidate?.let { ...do a lot of stuff }
  • 16. class Person ( val name: String, val surName: String, var age: Int, val address: Address? ) { val fullName = "$name $surName" fun grow(years: Int = 1) { age += years } fun getNationality() = address?.country }
  • 17. data class Person( val name: String, val surName: String, var age: Int, val address: Address? ) fun brother(person:Person, brotherName: String) = person.copy(name = brotherName)
  • 19. Java public interface Callback { void onFinish(String result); } public void operation(Callback callback) { //perform operation callback.onFinish(result); } operation(new Callback() { @Override public void onFinish(String result) { //Do finishing stuff } });
  • 20. Kotlin fun operation(callback: (String) -> Unit) { //perform operation callback("") } operation { result -> //finish it }
  • 22. Java 7 List<Person> grow(List<Person> persons) { for (Person person : persons) { person.setAge(person.getAge()+1); } } Java 8 List<Person> grow(List<Person> persons) { return persons.stream() .map (person -> person.setAge(person.getAge()+1)) .toList() } Kotlin fun grow(persons: List<Person>) = persons.map { it.age +1 }
  • 23. Real case Transform this: "(JAVA OR J2EE OR JAVA2E OR JAVA2EE OR JEE) AND (DESARROLLADOR OR DEVELOPER OR PROGRAMADOR OR PROGRAMMER) AND (SISTEMAS OR SISTEMES)", "java or j2ee", "Java", "Android", "(JAVA OR J2EE OR JAVA2EE OR JEE OR JAVA2E) AND (PROGRAMADOR OR PROGRAMMER OR DEVELOPER OR DESARROLLADOR)" Into this: "java", "J2EE", "JAVA2E", "JAVA2EE", "JEE", "DESARROLLADOR", "DEVELOPER", "PROGRAMADOR", "PROGRAMMER", "SISTEMAS", “SISTEMES", "android" private fun mapKeywords(keywords: List<String>) = keywords .map { it.split(Regex("( AND )|( OR )|(|)| |,|¿|"|'")) } .flatten() .filter { it.isNotBlank() } .distinctBy { it.toLowerCase() }
  • 24. And much more! (but we are out of time)
  • 25. More info https://kotlinlang.org https://jetbrains.com https://play.kotlinlang.org/koans (Kotlin Koans) https://antonioleiva.com/ (buy his book!) If you have any question: @sergiandreplace (and I’ll be around the hackathon)