Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kotlin on the Cloud
Search
João Carvalho
October 12, 2017
Programming
1
320
Kotlin on the Cloud
Slides for my 'Kotlin on the Cloud' talk at the Google Developer Group Lisboa's Kotlin Night.
João Carvalho
October 12, 2017
Tweet
Share
More Decks by João Carvalho
See All by João Carvalho
Kotlin - Not you grandfather's Java
joaopecarvalho
0
5.7k
Jigsaw - The Modular JDK
joaopecarvalho
0
3.5k
Bringing a Legacy Java Application to 2015
joaopecarvalho
0
2.5k
Fenix 3
joaopecarvalho
1
370
Developing Modular Web Applications
joaopecarvalho
0
150
Other Decks in Programming
See All in Programming
ML-прайсинг_на_Lamoda__вошли_и_вышли__приключение_на_20_минут__Слава_Цыганков.pdf
lamodatech
0
390
Kubernetes上でOracle_Databaseの運用を楽にするOraOperatorの紹介
nnaka2992
0
170
LangChain & LangServeでAPIを爆速作成
kijitorabuti
2
360
.NET Aspireのクラウド対応検証: Azureと他環境での実践
ymd65536
1
660
sqlcを利用してsqlに型付けを
kamiyam
0
250
DevFest Android in Korea 2024 - 안드로이드의 문단속 : 앱을 지키는 암호화 이야기
mdb1217
1
180
学生の時に開催したPerl入学式をきっかけにエンジニアが組織に馴染むために勉強会を主催や仲間と参加して職能間の境界を越えていく
ohmori_yusuke
2
330
モジュラモノリス、その前に / Modular monolith, before that
euglena1215
8
750
App Store Connect APIで 作業時間を増やそう
mot_techtalk
3
130
Prompt Engineering for Developers @ AWS Community Day Adria 2024
slobodan
0
100
Re:proS_案内資料
rect
0
150
個人開発で使ってるやつを紹介する回
yohfee
1
730
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
268
27k
Pencils Down: Stop Designing & Start Developing
hursman
119
11k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.6k
Git: the NoSQL Database
bkeepers
PRO
425
64k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
Code Reviewing Like a Champion
maltzj
519
39k
Building Applications with DynamoDB
mza
90
6k
Side Projects
sachag
452
42k
Transcript
Kotlin on the Cloud João Carvalho - GDG Lisboa -
Oct 12 2017
About me
About me • Senior Developer / Team Lead @ Talkdesk
• Backend Developer • IST Alumni (Student & Developer) • PT.JUG Speaker • Follow me on Twitter @johnkarva
Cloud Native Apps https://pivotal.io/cloud-native
“Cloud-native is an approach to building and running applications that
fully exploits the advantages of the cloud computing delivery model. Cloud-native is about how applications are created and deployed, not where.”
• Devops • Continuous Delivery • Microservices • Containerization
Predictability
12 Factor App 1. Single codebase, multiple deploys 2. Explicit
Dependencies 3. Store Config in Environment 4. Backing Services as resources 5. Separate Build, Release, Execution 6. Standalone (Volatile) Process 7. Port Binding 8. Multiple Process Types 9. Disposability 10. Environment Parity 11. Logs as Event Streams 12. One-off Admin Tasks
OS-Agnostic
Auto-Scaling
Independence
Quick Recovery
Agility
Kotlin
Why not Java 8/9?
Null Safety
public void printName(Person person) { System.out.println(person.getName()); }
public void printName(Person person) { System.out.println(person.getName()); } null
None
fun printName(person: Person) { println(person.name) }
printName(null) ERROR: Null cannot be a value of non-null type
Person.
fun printName(person: Person?) { if (person != null) { println(person.name)
} }
Safe Navigation
private String safeGetName(Person person) { return person == null ?
null : person.getName(); }
fun safeGetName(person: Person?): String? { return person?.name }
fun safeGetName(person: Person?): String { return person?.name ?: "Unknown" }
Properties
class Person(name: String) { private val name: String init {
this.name = name } }
class Person(private val name: String)
Delegated Properties
val lazyValue: String by lazy { println("computed!") "Hello" }
Extension Functions
fun String.helloize() = "Hello $this" "World".helloize()
Data Classes
public class Person { private String name; private int age;
public Person(String name, int age) { this.name = name; this.age = age; } (...) }
public String getName() { return name; } public void setName(String
name) { this.name = name; } @Override public boolean equals(Object o) { (Stuff generated by your IDE) } @Override public int hashCode() { int result = name.hashCode(); result = 31 * result + age; return result; }
None
data class Person(var name: String, var age: Int)
data class Person(val name: String, val age: Int)
val john = Person("John", 21) val olderJohn = john.copy(age =
78)
And much more... • No Semicolons! • Lambda Expressions and
Inline Functions • Type inference • Named Arguments • Default Values • String Interpolation • Ranges • Immutable Collections (Kind of) • Collection helpers • Infix Functions • DSL Support
Performance
Tooling
Getting Started
None
None
None
None
@RestController @SpringBootApplication public class DemoApplication { public static void main(String[]
args) { SpringApplication.run(DemoApplication.class, args); } @GetMapping("/hello") public String hello() { return "Hello World!"; } }
http://shop.oreilly.com/product/0636920038252.do
Cloud-Native Kotlin?
None
https://docs.spring.io/spring/docs/current/spring-framework-reference/kotlin.html
Demo Time!
Questions?