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
480
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
More Decks by João Carvalho
See All by João Carvalho
Kotlin - Not you grandfather's Java
joaopecarvalho
0
7.9k
Jigsaw - The Modular JDK
joaopecarvalho
0
3.7k
Bringing a Legacy Java Application to 2015
joaopecarvalho
0
2.5k
Fenix 3
joaopecarvalho
1
400
Developing Modular Web Applications
joaopecarvalho
0
190
Other Decks in Programming
See All in Programming
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
2k
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.7k
AIで効率化できた業務・日常
ochtum
0
130
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
190
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
190
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
7
4.2k
ふつうのFeature Flag実践入門
irof
7
3.8k
Lessons from Spec-Driven Development
simas
PRO
0
180
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
280
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
6.5k
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
540
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
3.7k
Featured
See All Featured
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
530
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
We Are The Robots
honzajavorek
0
250
New Earth Scene 8
popppiees
3
2.3k
Marketing to machines
jonoalderson
1
5.4k
Skip the Path - Find Your Career Trail
mkilby
1
150
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
470
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
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?