24
SPRING BOOT AND KOTLIN, A MATCH MADE IN HEAVEN @NICOLAS_FRANKEL

Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

Embed Size (px)

Citation preview

Page 1: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

SPRING BOOT AND KOTLIN, A MATCH MADE IN HEAVEN@NICOLAS_FRANKEL

Page 2: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

SWITZERLAND

Page 3: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

SWITZERLAND

Page 4: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

SWITZERLAND

Page 5: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

ME, MYSELF AND I Developer/Software

-/Solution Architect• Java• As consultant

Page 6: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

HYBRIS, AN SAP COMPANY

Page 7: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

Page 8: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

Page 9: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

WHY SPRING BOOT?Convention over configuration• Kickstart a project in minutes,

not daysOut-of-the-box features•Actuator

Page 10: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

Page 11: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

KOTLIN

@nicolas_frankel #kotlin #springboot

Open SourceCompiles to• JVM bytecode• JavaScript (experimental)

A "simpler Scala"

@nicolas_frankel #kotlin #springboot

Page 12: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

KOTLIN MAIN FEATURES

@nicolas_frankel #kotlin #springboot

Functional and object-orientedStatically typedNull safetyNo checked exceptionsNamed & optional argumentsLambdasExtension functionsJava compatibility(And more...)

@nicolas_frankel #kotlin #springboot

Page 13: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

KOTLIN MAIN BENEFITS

@nicolas_frankel #kotlin #springboot

More expressive than JavaImproved OOFunctional too

Page 14: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

HELLO KOTLIN!package hello // no semicolons

// namespace-level functions// types on the right// no special syntax for arrays// optional return typefun main(args: Array<String>) { println("Hello Kotlin!")}

@nicolas_frankel #kotlin #springboot@nicolas_frankel #kotlin #springboot

Page 15: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

THE KILLER FEATURE: EXTENSIONSExtension methodsExtension properties

Page 16: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

EXTENSION METHODAdd new methods on an existing typeCalled like a method on the typeTranslated to static Util method in the bytecode

Page 17: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

ENOUGH TALK…

Time for DEMO

Page 18: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

SPRING BOOT KOTLIN INTEGRATIONKotlin integration OOTBCode more terseJava configuration files less verbose

Page 19: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

ENOUGH TALK…

Time for DEMO

Page 20: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

MY PROJECTMigrating my WordPress blog to Jekyll• From one single XML export• To a Markdown file per post

Page 21: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

TYPICAL BATCH SCENARIORead• XML file

Transform• Add image size• Replace links• Etc.

Write• Markdown files

Page 22: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

HIGHLIGHTSExpression body methodsMany one-liners into one fileExpression properties

Page 23: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

KEY TAKEAWAYS

Page 24: Morning at Lohika - Spring Boot Kotlin, a match made in Heaven

@nicolas_frankel #kotlin #springboot

Q&A

http://blog.frankel.ch/@nicolas_frankel http://frankel.in/https://git.io/vVSLG