Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ktor - Foundations

Ktor - Foundations

Ktor - Foundations
Workshop on Ktor
Class 1.
https://github.com/jggomez/Ktor_Workskop

2a31aa30e3f9eeb22493a01a52833883?s=128

Juan Guillermo Gómez Torres

September 08, 2020
Tweet

Transcript

  1. Ktor Workshop

  2. 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 hola@devhack.co. ➢ Disfruta y sé feliz !!!
  3. 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
  4. 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.
  5. Kotlin

  6. Kotlin ➢ Official for Android Apps 2017. ➢ IntelliJ and

    Android Studio 3.0+. ➢ Server side. ➢ Use Java Libraries.
  7. Kotlin for Server Side https://kotlinlang.org/docs/reference/server-overview.html

  8. 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
  9. Basic Types

  10. Basic Types

  11. Basic Types

  12. Basic Types

  13. Basic Types

  14. Control Flow

  15. Control Flow

  16. Control Flow

  17. Control Flow

  18. Range

  19. Return and Jumps

  20. 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
  21. Functions

  22. ➢ 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.
  23. None
  24. None
  25. None
  26. None
  27. None
  28. 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.
  29. 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.
  30. REFERENCES https://kotlinlang.org/docs/reference/ https://try.kotlinlang.org/ https://kotlin.es/ https://ktor.io/

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