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

Preview:

Citation preview

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

@nicolas_frankel #kotlin #springboot

SWITZERLAND

@nicolas_frankel #kotlin #springboot

SWITZERLAND

@nicolas_frankel #kotlin #springboot

SWITZERLAND

@nicolas_frankel #kotlin #springboot

ME, MYSELF AND I Developer/Software

-/Solution Architect• Java• As consultant

@nicolas_frankel #kotlin #springboot

HYBRIS, AN SAP COMPANY

@nicolas_frankel #kotlin #springboot

@nicolas_frankel #kotlin #springboot

@nicolas_frankel #kotlin #springboot

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

not daysOut-of-the-box features•Actuator

@nicolas_frankel #kotlin #springboot

KOTLIN

@nicolas_frankel #kotlin #springboot

Open SourceCompiles to• JVM bytecode• JavaScript (experimental)

A "simpler Scala"

@nicolas_frankel #kotlin #springboot

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

KOTLIN MAIN BENEFITS

@nicolas_frankel #kotlin #springboot

More expressive than JavaImproved OOFunctional too

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

@nicolas_frankel #kotlin #springboot

THE KILLER FEATURE: EXTENSIONSExtension methodsExtension properties

@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

@nicolas_frankel #kotlin #springboot

ENOUGH TALK…

Time for DEMO

@nicolas_frankel #kotlin #springboot

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

@nicolas_frankel #kotlin #springboot

ENOUGH TALK…

Time for DEMO

@nicolas_frankel #kotlin #springboot

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

@nicolas_frankel #kotlin #springboot

TYPICAL BATCH SCENARIORead• XML file

Transform• Add image size• Replace links• Etc.

Write• Markdown files

@nicolas_frankel #kotlin #springboot

HIGHLIGHTSExpression body methodsMany one-liners into one fileExpression properties

@nicolas_frankel #kotlin #springboot

KEY TAKEAWAYS

@nicolas_frankel #kotlin #springboot

Q&A

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

Recommended