Slide 1

Slide 1 text

Evolutionary Architecture: Evolving even the language Luram Archanjo

Slide 2

Slide 2 text

Who am I? ● Software Engineer at Sensedia ● MBA in Java projects ● Java and Microservice enthusiastic

Slide 3

Slide 3 text

Agenda ● Use case ● Microservices ● Evolutionary Architecture ● Challenges to adopt Kotlin ● Kotlin benefits ● Questions

Slide 4

Slide 4 text

Use case

Slide 5

Slide 5 text

Use case Token Service Provider Tokenization reduces the value of stored payment credentials by removing consumers’ primary account numbers (PANs) from the transaction process. It does this by replacing them with a unique identifier called a payment token. This reduces the appeal of stealing the credentials as they would be largely useless to hackers. Source: https://www.rambus.com/blogs/what-is-a-token-service-provider/

Slide 6

Slide 6 text

Use case

Slide 7

Slide 7 text

Microservices

Slide 8

Slide 8 text

Moving to Microservices Feature A Feature B Feature C Monolith Microservice Microservice Microservices Microservice

Slide 9

Slide 9 text

Technological Heterogeneity Microservice Microservice Microservice DB DB DB

Slide 10

Slide 10 text

Evolutionary Architecture

Slide 11

Slide 11 text

Evolutionary Architecture An evolutionary architecture supports guided, incremental change as a first principle across multiple dimensions. Source: https://www.thoughtworks.com/books/building-evolutionary-architectures

Slide 12

Slide 12 text

Our stack

Slide 13

Slide 13 text

Evolutionary Architecture Languages Technologies Databases

Slide 14

Slide 14 text

All(15) microservices were written in

Slide 15

Slide 15 text

We wanted to change, but there were many challenges!

Slide 16

Slide 16 text

● Expertise in Java Frameworks e.g: Spring Stack, Hibernate etc. ● Expertise in Object-Oriented Programming ● Learning curve, sprint in progress Evolutionary Architecture

Slide 17

Slide 17 text

is going to overcome all of those challenges?

Slide 18

Slide 18 text

Yes!!!

Slide 19

Slide 19 text

Expertise in Java Frameworks Expertise in Object-Oriented Programming Learning curve, sprint in progress

Slide 20

Slide 20 text

Expertise in Java Frameworks Interoperability: Kotlin is fully compatible with all Java-based frameworks, which lets you stay on your familiar technology stack while reaping the benefits of a more modern language. Java code Kotlin code Java Virtual Machine (JVM) Bytecode Source: https://kotlinlang.org/docs/reference/server-overview.html

Slide 21

Slide 21 text

Expertise in Java Frameworks

Slide 22

Slide 22 text

Expertise in Java Frameworks Expertise in Object-Oriented Programming Learning curve, sprint in progress

Slide 23

Slide 23 text

Expertise in Object-Oriented Programming Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data, in the form of fields (often known as attributes), and code, in the form of procedures (often known as methods). Source: https://en.wikipedia.org/wiki/Object-oriented_programming Code data class Person(val firstName: String, val surname: String, val age: Int) { fun fullName() = "$firstName $surname" }

Slide 24

Slide 24 text

Expertise in Object-Oriented Programming Functional programming is a programming paradigm based structures and elements of computer programs, that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. Source: https://en.wikipedia.org/wiki/Functional_programming Code data class Person(val name: String, String, val age: Int) val persons = listOf(Person("Person 1", 15), Person("Person 2", 22)) persons.filter { person -> person.age >= 18 }

Slide 25

Slide 25 text

Expertise in Java Frameworks Expertise in Object-Oriented Programming Learning curve, sprint in progress

Slide 26

Slide 26 text

Learning curve, sprint in progress Source: https://kotlinlang.org/docs/reference/server-overview.html Migration: Kotlin supports gradual, step by step migration of large codebases from Java to Kotlin. You can start writing new code in Kotlin while keeping older parts of your system in Java. Microservice Java Microservice Java Kotlin Microservice Kotlin

Slide 27

Slide 27 text

Learning curve, sprint in progress

Slide 28

Slide 28 text

Kotlin benefits

Slide 29

Slide 29 text

40% less code

Slide 30

Slide 30 text

40% less code Java public class Person { private final String name; private final Integer age; public Person(String name, Integer age) { this.name = name; this.age = age; } public String getName() { return name; } public Integer getAge() { return age; } } Kotlin data class Person(val name: String, val age: Int) Default Values data class Person(val name: String = "Unknown", val age: Int = 0) Initialization val person = Person("Luram Archanjo", 25) val person = Person() // Name = Unknown & age = 0

Slide 31

Slide 31 text

Null Safety

Slide 32

Slide 32 text

Null Safety Java final Person person = null; // accept null person.getName().length(); Exception java.lang.NullPointerException Kotlin val person: Person = null // compilation error val person: Person? = null // accept null person.name.length // compilation error Safe Calls person?.name?.length // return null Elvis Operator person?.name?.length ?: 0 // return 0 if null

Slide 33

Slide 33 text

Performs lots of checks, reducing runtime errors and the number of bugs in the code

Slide 34

Slide 34 text

Who is using Kotlin? Why?

Slide 35

Slide 35 text

Who is using Kotlin? Why? Source: https://github.com/ygaller/kotlin-companies/wiki

Slide 36

Slide 36 text

Fail-fast principle = Time to market

Slide 37

Slide 37 text

Summary 2º Place 1º Place 3º Place Interoperable with Java ● Known frameworks ● Low learn curve Concise ● Easier to maintain ● Easier to read ● Easier to apply changes when necessary Modern ● Safe compiler ● Type interface ● Collection ● Lambdas

Slide 38

Slide 38 text

Thanks a million! Questions? /larchanjo /luram-archanjo