Slide 1

Slide 1 text

Ktor Workshop

Slide 2

Slide 2 text

Consejos ➢ Mira todo desde lo positivo, este workshop es con amor. ➢ Comparte en redes fotos o mensajes positivos sobre el Workshop en twitter o facebook y nombra a @devhackcali @jggomezt. ➢ Respeto a los compañeros y mentores. ➢ Cerrar los micrófonos. ➢ Apagar cámaras. ➢ Puedes realizar las preguntas que sean sobre el tema en cuestión, hacerlas en el chat de Q&A. ➢ Si tienes un feedback constructivo escríbenos a [email protected]. ➢ Disfruta y sé feliz !!!

Slide 3

Slide 3 text

Juan Guillermo Gómez ➢ Co-Leader y Co-Founder of GDG Cali. ➢ Tech Lead at WordBox & Founder at DevHack ➢ Consultant and advisor on software architecture, cloud computing and software development. ➢ Experience in several languages and platforms. (C, C#, Java, NodeJS, android, GCP, Firebase). ➢ Google Developer Expert (GDE) in Firebase & GCP ➢ BS in System Engineering and a MS in Software Engineering. ➢ @jggomezt

Slide 4

Slide 4 text

Kotlin ➢ Open-sourced 2012. ➢ Developed by JetBrains. ➢ Version 1.0 in 2016. ➢ Modern programming language ➢ Object Oriented. ➢ Statically typed. ➢ Less code with fewer bugs. ➢ Lambdas and properties. ➢ Nullable and non-nullable data type. ➢ Very concise. ➢ Remove a lot of boilerplate from code. ➢ Readability. ➢ Functional constructs. ➢ Object Oriented. ➢ Use Java Libraries. ➢ Immutability.

Slide 5

Slide 5 text

Kotlin

Slide 6

Slide 6 text

Kotlin ➢ Official for Android Apps 2017. ➢ IntelliJ and Android Studio 3.0+. ➢ Server side. ➢ Use Java Libraries.

Slide 7

Slide 7 text

Kotlin for Server Side https://kotlinlang.org/docs/reference/server-overview.html

Slide 8

Slide 8 text

Kotlin vs java Features Java Kotlin Fully OOP Not pure OOP Fully OOP Null safety No Yes Checked Exception Yes No Invariant Array No Yes Smart Casts No Yes Lambda Expression No Yes Immutability No Yes

Slide 9

Slide 9 text

Basic Types

Slide 10

Slide 10 text

Basic Types

Slide 11

Slide 11 text

Basic Types

Slide 12

Slide 12 text

Basic Types

Slide 13

Slide 13 text

Basic Types

Slide 14

Slide 14 text

Control Flow

Slide 15

Slide 15 text

Control Flow

Slide 16

Slide 16 text

Control Flow

Slide 17

Slide 17 text

Control Flow

Slide 18

Slide 18 text

Range

Slide 19

Slide 19 text

Return and Jumps

Slide 20

Slide 20 text

Nullable types and Non-Null Types ➢ One of the most common pitfalls in many programming languages, including Java ➢ NullPointerException ➢ Eliminating the danger of null references from code ➢ The billion dollar mistake ➢ A regular variable of type String can not hold null. ➢ We can declare a variable as nullable string, written String? ➢ Safe Calls. b?.length ➢ Elvis operator => b?.length ?: -1

Slide 21

Slide 21 text

Functions

Slide 22

Slide 22 text

➢ Ktor is a framework for building asynchronous servers and clients in connected systems using the powerful Kotlin. ➢ Creating web applications ➢ Creating web services ➢ Connecting to services and applications.

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

configured server engine modules features routing A Ktor Server Application is a custom program listening to one or more ports using a configured server engine, composed by modules with the application logic, that install features, like routing, sessions, compression, etc. to handle HTTP/S 1.x/2.x and WebSocket requests.

Slide 29

Slide 29 text

Challenge Crea un programa para una tienda de ropa que permita: ○ Pedir datos del cliente (nit, nombres, fecha de nacimiento, genero, email y número de contacto) ○ Enviar un email de registro diciéndole que es un cliente de tipo (Oro, Plata o Bronce) dependiendo lo siguiente: ■ Si es hombre o mujer entre los 20 y 30 es Bronce ■ Si es mujer entre entre los 30 y 50 es Plata ■ Si es hombre entre los 30 y 40 sigue siendo Bronce. ■ Si es hombre entre los 40 y 50 es Plata. ■ Si es hombre o mujer mayor de los 50 es cliente Oro. ○ El sistema debe enviar el correo y mostrar en pantalla, el tipo de cliente que es.

Slide 30

Slide 30 text

REFERENCES https://kotlinlang.org/docs/reference/ https://try.kotlinlang.org/ https://kotlin.es/ https://ktor.io/

Slide 31

Slide 31 text

https://www.facebook.com/escueladevhack/ Escuela de Hackers www.devhack.co https://github.com/escueladevhack