SlideShare a Scribd company logo
1 of 90
Kotlin für Android/Java-
Entwickler
Malte Bucksch 1
Agenda
I. Einführung
II. Setup
III. Kotlin
1. Variablen und Konstanten
2. Funktionen
3. Klassen
4. Optionals
5. Kontroll-Fluss
6. Extensions
7. Lambdas
Malte Bucksch 2
Wieso Kotlin?
Concise SafeInter-
operable
Malte Bucksch 3
Anwendungsgebiete
JVM Android Browser Native
Malte Bucksch 4
Firmen, die Kotlin nutzen
Evernote
Malte Bucksch 5
Java-to-Kotlin Converter
Malte Bucksch 6
Setup
Malte Bucksch 7
Setup
https://github.com/quickbirdstudios/KotlinBasics
1 2
3
Malte Bucksch 8
Just say NO
Malte Bucksch 9
Setup
appsrctestjavacomquickbirdstudioskotlinbasicsexercises
Malte Bucksch 10
Hacking
Führe alle Tests aus und stell sicher, dass alle Tests fehlschlagen
Run Tests in
‘exercises’
Rechtsklick…
Malte Bucksch 11
Malte Bucksch 12
Bruno
Malte Bucksch 13
Variablen und Konstanten
Malte Bucksch 14
String myVariable = "Change me";
final String myConstant = "Can't change me";
var myVariable: String = "Change me“
val myConstant: String = "Can't change me"
15
String myVariable = "Change me";
final String myConstant = "Can't change me";
var myVariable: String = "Change me“
val myConstant: String = "Can't change me"
16
final String myConstant = "Can't change me";
String myVariable = "Change me";
val myConstant = "Can't change me"
var myVariable = "Change me"
17
Funktionen
Malte Bucksch 18
Funktionen
fun bark(times: Int): String {
return "Wuff".repeat(times)
}
Function Keywort Return Typ
Malte Bucksch 19
Funktionen
fun bark(times: Int = 1): String {
return "Wuff".repeat(times)
}
Standard-Wert
Malte Bucksch 20
Funktionen
fun bark(times: Int = 1) = "Wuff".repeat(times)
Malte Bucksch 21
Aufrufen von Funktionen
dog.bark()
dog.bark(3)
dog.bark(times = 3)
Malte Bucksch 22
Klassen
Malte Bucksch 23
public class JavaHuman {
private String name;
private int age;
public JavaHuman(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public void sayHello(String otherPersonName){
System.out.println("Hi, nice to see you "+otherPersonName);
}
public void sayHello(){
sayHello("");
}
}
class KotlinHuman(var name: String, var age: Int) {
fun sayHello(otherPersonName: String = "") {
println("Hi, nice to see you $otherPersonName")
}
}
24
Kotlin Klasse
class KotlinHuman(var name: String, var age: Int) {
fun sayHello(otherPersonName: String = "") {
println("Hi, nice to see you $otherPersonName")
}
}
Primary Constructor
Malte Bucksch 25
Kotlin Klasse
class KotlinHuman(var name: String, var age: Int) {
fun sayHello(otherPersonName: String = "") {
println("Hi, nice to see you $otherPersonName")
}
}
String template
Malte Bucksch 26
Getters and setters
class KotlinHuman(var name: String, var age: Int) {
var cityAddress = "Munich"
fun sayHello(otherPersonName: String = "") {
println("Hi, nice to see you $otherPersonName")
}
}
Malte Bucksch 28
Zugriff auf Properties
Malte Bucksch 29
val human = KotlinHuman()
human.cityAddress = "Hamburg“
val address = human.cityAddress
Getters and setters
class KotlinHuman(var name: String, var age: Int) {
var cityAddress = "Munich"
fun sayHello(otherPersonName: String = "") {
println("Hi, nice to see you $otherPersonName")
}
}
Malte Bucksch 30
Getters and setters
class KotlinHuman(var name: String, var age: Int) {
var cityAddress = “Munich"
get() = "City $field"
set(city) {
if (city.length < 3)
throw IllegalArgumentException("City less than 3 chars")
field = city
}
fun sayHello(otherPersonName: String = "") {
println("Hi, nice to see you $otherPersonName")
}
}
Malte Bucksch 31
Instantierung von Klassen
val myKotlinHuman = KotlinHuman("Bruno",5)
Kein “new” Keywort
mehr
Malte Bucksch 33
Hacking
Malte Bucksch 36
Syntax-Beispiel
class KotlinHuman(var name: String, var age: Int) {
fun sayHello(otherPersonName: String = "") {
println("Hi, nice to see you $otherPersonName")
}
}
return “Hallo".repeat(5)
Öffne 1_SimpleDogClass.kt
Malte Bucksch 37
Lösung
Malte Bucksch 38
private class Dog(var name: String, val type: String) {
fun bark(times: Int) = println("Wuff".repeat(times))
}
@Test
fun testMyNewDogClass() {
val dog = Dog("Bruno","Labrador")
dog.bark(3)
}
Optionals
Malte Bucksch 39
Nullpointer exceptions
public void sayHello(Dog otherDog){
System.out.println(“Wuff, "+ otherDog.getName());
}
sayHello(null);
Malte Bucksch 40
Kotlin Null-Sicherheit
fun sayHello(otherDog: Dog) {
println("Hi, " + dog.name);
}
sayHello(null);
Malte Bucksch 41
Compiler Error.
var dog: Dog = null
Malte Bucksch 42
Optionals als seperater Typ
var dog: Dog? = null
Malte Bucksch 43
Aufrufen von Kotlin Optionals
val dog: Dog? = findDog()
dog.bark()
Malte Bucksch 44
Aufrufen von Kotlin Optionals
val dog: Dog? = findDog()
if(dog != null){
dog.bark(3)
}
Malte Bucksch 45
Safe Call Operator
val dog: Dog? = findDog()
dog?.bark()
Malte Bucksch 46
For all NPE lovers
val dog: Dog? = findDog()
dog!!.bark()
Malte Bucksch 47
Elvis Operator
val myDog = findDog() ?: buyNewDog()
Malte Bucksch 48
Automatic casting
if(dog != null){
dog.bark(3)
}
val anyObject: Any = getAnimal()
if(anyObject is Dog){
anyObject.bark()
}
Malte Bucksch 49
Hacking
Malte Bucksch 50
Syntax-Beispiel
Öffne 2_Optionals.kt
human?.sayHello()
val myDog = findDog() ?: buyNewDog()
// Safe casts
val name = (any as? Cat)?.name
Malte Bucksch 51
Lösung
Malte Bucksch 52
private fun letDogBark(dog: Dog?) {
// TODO TASK 1
dog?.bark()
}
private fun getDogName(dog: Dog?): String {
// TODO TASK 2
return dog?.name ?: "No dog found"
}
private fun getNameOf(any: Any): String {
// TODO TASK 3
return (any as? Dog)?.name ?: "type unknown"
}
Kontrollfluss
Malte Bucksch 53
For Schleife
Malte Bucksch 54
val dogs = getDogs()
for (dog in dogs){
dog.bark()
}
For Schleife
Malte Bucksch 55
val dogs = getDogs()
for (index in 0..10){
dogs[index].bark()
}
Range Operator
When: Java Switch mit Superkräften
fun getDogPluralString(dogCount: Int): String {
when(dogCount){
0 -> return "Keine Hunde"
1 -> return "Ein Hund"
else -> return "$dogCount Hunde"
}
}
Malte Bucksch 56
When: Java Switch mit Superkräften
fun getDogPluralString(dogCount: Int): String {
when(dogCount){
0 -> return "Keine Hunde"
1 -> return "Ein Hund"
else -> return "$dogCount Hunde"
}
}
Malte Bucksch 57
When: Java Switch mit Superkräften
fun getDogPluralString(dogCount: Int): String {
return when(dogCount){
0 -> "Keine Hunde"
1 -> "Ein Hund"
else -> "$dogCount Hunde"
}
}
Malte Bucksch 58
When: Java Switch mit Superkräften
fun getDogPluralString(dogCount: Int) = when (dogCount) {
0 -> "Keine Hunde"
1 -> "Ein Hund"
else -> "$dogCount Hunde"
}
Malte Bucksch 59
When ohne Argument
fun evaluatePassword(password: String): String {
return when {
password.isEmpty() -> "Bitte gib ein Passwort ein"
password.length < 5 -> "Passwort ist nicht lang genug"
!password.containsNumber() -> "Passwort muss eine Ziffer enthalten"
else -> "Das Passwort ist valide"
}
}
Malte Bucksch 60
Hacking
Malte Bucksch 61
Syntax-Beispiel
Öffne 3_ControlFlow.kt
when(dogCount){
0 -> return "Keine Hunde"
1 -> return "Ein Hund"
else -> return "$dogCount Hunde"
}
return when (dogCount) {
in 0..4 -> "..."
4, 5 -> "..."
else -> "..."
}
Malte Bucksch 62
Lösung
Malte Bucksch 63
// TODO TASK 1
fun findDogOwnerName(dog: Dog): String? {
return when(dog.name){
"Bruno" -> "Hans"
"Ignatz" -> "Peter"
else -> null
}
}
// TODO TASK 2
fun ageToString(dog: Dog): String {
return when(dog.age){
0,1 -> "Baby Dog"
in 2..8 -> "Normal Dog"
else -> "Old Dog"
}
}
Extensions
Malte Bucksch 64
println("Ich heiße Bruno".barkify())
// “WUFF WUFF WUFF”
Malte Bucksch 65
Extension Funktion: Zahl gerade oder
ungerade
fun Int.isEven(): Boolean {
return this % 2 == 0
}
println(1.isEven()) // false
println(2.isEven()) // true
println(3.isEven()) // false
Malte Bucksch 66
Hacking
Malte Bucksch 67
Syntax-Beispiel
Öffne 4_Extensions.kt
fun Int.isEven(): Boolean {
return this % 2 == 0
}
Malte Bucksch 68
Lösung
Malte Bucksch 69
// TODO TAKS 1
fun String.scream(): String {
return this.toUpperCase()+"!!!"
}
// TODO TASK 2
private fun applyAllCapsExtension(text: String): String {
return text.scream()
}
@Test
fun testAllCapsDogLanguage() {
// TODO TASK 3
val allCapsDogLanguage = "Ich habe ganz viel Hunger".barkify().scream()
assertEquals("WUFF WUFF WUFF WUFF WUFF!!!", allCapsDogLanguage)
}
Lambdas & Higher Order Functions
Malte Bucksch 70
Lambda Funktionsreferenz
val dog = Dog("Bruno")
val bark = dog::bark
bark(times = 3)
Malte Bucksch 71
Lambda Definition
val dog = Dog("Bruno")
val greetDog: (Dog) -> String = { dog -> "Hey! ${dog.name}" }
println(greetDog(dog))
Parameter type Return type
Malte Bucksch 72
Lambda Definition
val dog = Dog("Bruno")
val greetDog: (Dog) -> String = { dog -> "Hey! ${dog.name}" }
println(greetDog(dog))
Parameter name Lambda Body
Malte Bucksch 73
Higher Order Functions: Filter
Malte Bucksch 74
Filtern von Hunden
Malte Bucksch 75
Filter Funktion
var dogs: List<Dog> = animals.filter(
…
)
Malte Bucksch 76
Filter Prädikat/Bedingung
{ animal -> animal is Dog }
??
Malte Bucksch 77
Filter Funktion
var dogs = animals.filter({ animal ->
animal is Dog
})
Malte Bucksch 78
Filter Funktion
var dogs = animals.filter(){ animal ->
animal is Dog
}
Malte Bucksch 79
Filter Funktion
var dogs = animals.filter { animal ->
animal is Dog
}
Malte Bucksch 80
Filter Funktion
var dogs = animals.filter { it is Dog }
Malte Bucksch 81
Higher Order Functions: Map
Malte Bucksch 82
Mapping von Hunden
age = 8 age = 2 age = 3age = 6 age = 11
age = 8 age = 2 age = 3age = 6 age = 11
Malte Bucksch 83
Mapping von Hunden
val dogs = listOf(Dog("Bello",age = 8),Dog("Rex",age = 2),
Dog("Lessi",age = 6),Dog("Bruno",age = 3),Dog("Bello",age = 11))
val dogAges = dogs.map { … }
Malte Bucksch 84
Map Prädikat/Bedingung
{ dog -> dog.age }
age = 8 age = 8
Malte Bucksch 85
Mapping von Hunden
val dogs = listOf(Dog("Bello",age = 8),Dog("Rex",age = 2),
Dog("Lessi",age = 6),Dog("Bruno",age = 3),Dog("Bello",age = 11))
val dogAges = dogs.map { dog -> dog.age }
Malte Bucksch 86
Mapping von Hunden
val dogs = listOf(Dog("Bello",age = 8),Dog("Rex",age = 2),
Dog("Lessi",age = 6),Dog("Bruno",age = 3),Dog("Bello",age = 11))
val dogAges = dogs.map { it.age }
Malte Bucksch 87
Mapping von Hunden
val dogs = listOf(Dog("Bello",age = 8),Dog("Rex",age = 2),
Dog("Lessi",age = 6),Dog("Bruno",age = 3),Dog("Bello",age = 11))
val dogAges = dogs.map { it.age }
val average = dogAges.average() (= 6)
Malte Bucksch 88
Kombination von Operatoren
val oldDogAgeAverage = dogs.map { it.age }.filter { it > 5 }.average()
Malte Bucksch 89
Hacking
Malte Bucksch 90
Syntax-Beispiel
Öffne 5_Lambdas.kt
val oldDogAgeAverage = dogs.map { it.age }.filter { it > 5 }.average()
Malte Bucksch 91
Lösung
Malte Bucksch 92
// TODO TASK 1
private fun findDogNames(dogs: List<Dog>): List<String> {
return dogs.map { it.name }
}
// TODO TASK 2
private fun findOldDogs(dogs: List<Dog>): List<Dog> {
return dogs.filter { it.age > 5 }
}
// TODO TASK 3
private fun findNamesOfOldDogs(dogs: List<Dog>): List<String> {
return dogs.filter { it.age > 5 }.map { it.name }
}
Mehr Kotlin Features
• Data Klassen (Autogeneriertes Equals, Hashcode & Clone)
• Mutable und Immutable lists
• Destructuring Declarations
• Infix Funktionen
• Extension Properties
• Sealed classes
• Sequences
• Explicit returns
…
Malte Bucksch 93
Kotlin Workshop (14/15 Dezember)
tiny.cc/kotlin
Malte Bucksch 94

More Related Content

What's hot

Declarative Thinking, Declarative Practice
Declarative Thinking, Declarative PracticeDeclarative Thinking, Declarative Practice
Declarative Thinking, Declarative PracticeKevlin Henney
 
Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2José Paumard
 
Connecting your phone and home with firebase and android things - James Cogga...
Connecting your phone and home with firebase and android things - James Cogga...Connecting your phone and home with firebase and android things - James Cogga...
Connecting your phone and home with firebase and android things - James Cogga...DroidConTLV
 
Javascript development done right
Javascript development done rightJavascript development done right
Javascript development done rightPawel Szulc
 
Functional Programming & Event Sourcing - a pair made in heaven
Functional Programming & Event Sourcing - a pair made in heavenFunctional Programming & Event Sourcing - a pair made in heaven
Functional Programming & Event Sourcing - a pair made in heavenPawel Szulc
 
Concurrent programming with Celluloid (MWRC 2012)
Concurrent programming with Celluloid (MWRC 2012)Concurrent programming with Celluloid (MWRC 2012)
Concurrent programming with Celluloid (MWRC 2012)tarcieri
 
Basic NLP with Python and NLTK
Basic NLP with Python and NLTKBasic NLP with Python and NLTK
Basic NLP with Python and NLTKFrancesco Bruni
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In JavaAndrei Solntsev
 
Effective Java and Kotlin
Effective Java and KotlinEffective Java and Kotlin
Effective Java and Kotlin경주 전
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with GroovyArturo Herrero
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinAndrey Breslav
 
Java 8 Streams & Collectors : the Leuven edition
Java 8 Streams & Collectors : the Leuven editionJava 8 Streams & Collectors : the Leuven edition
Java 8 Streams & Collectors : the Leuven editionJosé Paumard
 
CoderDojo: Intermediate Python programming course
CoderDojo: Intermediate Python programming courseCoderDojo: Intermediate Python programming course
CoderDojo: Intermediate Python programming courseAlexander Galkin
 
Creating Lazy stream in CSharp
Creating Lazy stream in CSharpCreating Lazy stream in CSharp
Creating Lazy stream in CSharpDhaval Dalal
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardMario Fusco
 
Snakes for Camels
Snakes for CamelsSnakes for Camels
Snakes for Camelsmiquelruizm
 
Kotlin: Why Do You Care?
Kotlin: Why Do You Care?Kotlin: Why Do You Care?
Kotlin: Why Do You Care?intelliyole
 

What's hot (20)

Java Full Throttle
Java Full ThrottleJava Full Throttle
Java Full Throttle
 
Declarative Thinking, Declarative Practice
Declarative Thinking, Declarative PracticeDeclarative Thinking, Declarative Practice
Declarative Thinking, Declarative Practice
 
Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2
 
Connecting your phone and home with firebase and android things - James Cogga...
Connecting your phone and home with firebase and android things - James Cogga...Connecting your phone and home with firebase and android things - James Cogga...
Connecting your phone and home with firebase and android things - James Cogga...
 
Functional programming in java
Functional programming in javaFunctional programming in java
Functional programming in java
 
Javascript development done right
Javascript development done rightJavascript development done right
Javascript development done right
 
Functional Programming & Event Sourcing - a pair made in heaven
Functional Programming & Event Sourcing - a pair made in heavenFunctional Programming & Event Sourcing - a pair made in heaven
Functional Programming & Event Sourcing - a pair made in heaven
 
Concurrent programming with Celluloid (MWRC 2012)
Concurrent programming with Celluloid (MWRC 2012)Concurrent programming with Celluloid (MWRC 2012)
Concurrent programming with Celluloid (MWRC 2012)
 
Basic NLP with Python and NLTK
Basic NLP with Python and NLTKBasic NLP with Python and NLTK
Basic NLP with Python and NLTK
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In Java
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
 
Effective Java and Kotlin
Effective Java and KotlinEffective Java and Kotlin
Effective Java and Kotlin
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in Kotlin
 
Java 8 Streams & Collectors : the Leuven edition
Java 8 Streams & Collectors : the Leuven editionJava 8 Streams & Collectors : the Leuven edition
Java 8 Streams & Collectors : the Leuven edition
 
CoderDojo: Intermediate Python programming course
CoderDojo: Intermediate Python programming courseCoderDojo: Intermediate Python programming course
CoderDojo: Intermediate Python programming course
 
Creating Lazy stream in CSharp
Creating Lazy stream in CSharpCreating Lazy stream in CSharp
Creating Lazy stream in CSharp
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
 
Snakes for Camels
Snakes for CamelsSnakes for Camels
Snakes for Camels
 
Kotlin: Why Do You Care?
Kotlin: Why Do You Care?Kotlin: Why Do You Care?
Kotlin: Why Do You Care?
 

Similar to Kotlin Basics

Kotlin for backend development (Hackaburg 2018 Regensburg)
Kotlin for backend development (Hackaburg 2018 Regensburg)Kotlin for backend development (Hackaburg 2018 Regensburg)
Kotlin for backend development (Hackaburg 2018 Regensburg)Tobias Schneck
 
Kotlin from-scratch 2 - functions
Kotlin from-scratch 2 - functionsKotlin from-scratch 2 - functions
Kotlin from-scratch 2 - functionsFranco Lombardo
 
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...Naresha K
 
Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Cody Engel
 
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkA Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkZachary Blair
 
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup itPROIDEA
 
Kotlin / Android Update
Kotlin / Android UpdateKotlin / Android Update
Kotlin / Android UpdateGarth Gilmour
 
Refactor legacy code through pure functions
Refactor legacy code through pure functionsRefactor legacy code through pure functions
Refactor legacy code through pure functionsAlexandru Bolboaca
 
Swift rocks! #1
Swift rocks! #1Swift rocks! #1
Swift rocks! #1Hackraft
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]Baruch Sadogursky
 
Why Spring <3 Kotlin
Why Spring <3 KotlinWhy Spring <3 Kotlin
Why Spring <3 KotlinVMware Tanzu
 
KotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxKotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxIan Robertson
 
GeeCON Prague 2018 - Kotlin DSL in under an hour
GeeCON Prague 2018 - Kotlin DSL in under an hourGeeCON Prague 2018 - Kotlin DSL in under an hour
GeeCON Prague 2018 - Kotlin DSL in under an hourAnton Arhipov
 

Similar to Kotlin Basics (20)

Kotlin for backend development (Hackaburg 2018 Regensburg)
Kotlin for backend development (Hackaburg 2018 Regensburg)Kotlin for backend development (Hackaburg 2018 Regensburg)
Kotlin for backend development (Hackaburg 2018 Regensburg)
 
Introduction to Kotlin
Introduction to KotlinIntroduction to Kotlin
Introduction to Kotlin
 
Kotlin from-scratch 2 - functions
Kotlin from-scratch 2 - functionsKotlin from-scratch 2 - functions
Kotlin from-scratch 2 - functions
 
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
 
Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)
 
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkA Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application Framework
 
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
 
Kotlin
KotlinKotlin
Kotlin
 
Kotlin / Android Update
Kotlin / Android UpdateKotlin / Android Update
Kotlin / Android Update
 
Refactor legacy code through pure functions
Refactor legacy code through pure functionsRefactor legacy code through pure functions
Refactor legacy code through pure functions
 
Compose Code Camp (1).pptx
Compose Code Camp (1).pptxCompose Code Camp (1).pptx
Compose Code Camp (1).pptx
 
Swift rocks! #1
Swift rocks! #1Swift rocks! #1
Swift rocks! #1
 
Google Guava
Google GuavaGoogle Guava
Google Guava
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]
 
Pattern Matching in Java 14
Pattern Matching in Java 14Pattern Matching in Java 14
Pattern Matching in Java 14
 
Kotlin Coroutines - the new async
Kotlin Coroutines - the new asyncKotlin Coroutines - the new async
Kotlin Coroutines - the new async
 
Kotlin
KotlinKotlin
Kotlin
 
Why Spring <3 Kotlin
Why Spring <3 KotlinWhy Spring <3 Kotlin
Why Spring <3 Kotlin
 
KotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxKotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptx
 
GeeCON Prague 2018 - Kotlin DSL in under an hour
GeeCON Prague 2018 - Kotlin DSL in under an hourGeeCON Prague 2018 - Kotlin DSL in under an hour
GeeCON Prague 2018 - Kotlin DSL in under an hour
 

Recently uploaded

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 

Recently uploaded (20)

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 

Kotlin Basics

Editor's Notes

  1. - Vorstellen! Ich bin Malte Bucksch, Mitgründer von QuickBird Studios und Lead Android Developer Reden heut über kotlin FRAGE: Wer hat kotlin schon mal benutzt? Wer kennt swift?
  2. Heute praxisnah basics von kotlin lernen Ich werde nicht alle Features von Kotlin zeigen, aber wichtige und coole features Was die Vorteile sind Ich zeige lieber einige wichtige feature und ihr könnt sie direct ausprobieren, als nochmal alle features runter zu rattern. Da gibt es gut ressourcen online
  3. - Even can run on iOS
  4. - Wir machen es mit Android Studio -> weil es
  5. Keine Semicolons Schlanker Type wird automatisch erkannt -> das heißt NICHT, dass Kotlin nicht typsicher ist Wenn möglich sollten variable a
  6. Keine Semicolons Schlanker Type wird automatisch erkannt -> das heißt NICHT, dass Kotlin nicht typsicher ist Wenn möglich sollten variable a
  7. Keine Semicolons Schlanker Type wird automatisch erkannt -> das heißt NICHT, dass Kotlin nicht typsicher ist Wenn möglich sollten variable a
  8. - No semicolons anymore
  9. - No semicolons anymore
  10. - No semicolons anymore
  11. - In kotlin sind es 5 Zeilen code, in Java sind es .. Code TODO NOW
  12. - Show function with 3 int values with standard params and explain why named arguments are needed
  13. - Auf repeat hinweisen
  14. - Kennt man von java
  15. In java typen sind nullable by default. In kotlin nicht Ohne optionals und null checks ist programmieren ein wenig wie russisches Roulett: es geht moistens gut, aber eines tages! Programmier is SICHER, dass dort kein Null wert drin ist, ABER manchmal eben doch
  16. In java typen sind nullable by default. In kotlin nicht Ohne optionals und null checks ist programmieren ein wenig wie russisches Roulett: es geht moistens gut, aber eines tages! Programmier is SICHER, dass dort kein Null wert drin ist, ABER manchmal eben doch !! Was unseren hund sehr glücklich macht, weil er jetzt Hallo zu hunden sagen kann, ohne gefahr zu laufen seine ganze Applikation zu crashen
  17. - Es mag fälle geben wo man wirklich eine Exception haben will
  18. - Any ist Kotlin’s Object – Überklasse von allen Klassen
  19. - If/else same as in java
  20. - In kotlin: when breaks after each case
  21. - In kotlin: when breaks after each case
  22. - TODO NOW consider adding this exact code also in java if time to show difference -> don’t return but use println to make difference clear
  23. Lambdas sind Funktions objekte Man kann Referenzen auf Funktionen haben und sie herumreichen