Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to Kotlin - Workshop

62 views

Published on

Sytac sLab Workshop

Published in: Software
  • Be the first to comment

  • Be the first to like this

Introduction to Kotlin - Workshop

  1. 1. INTRODUCTION TO KOTLIN SYTAC - SLAB Shaun Thomas shaunthomas999@gmail.com www.shaunthomas999.com
  2. 2. WHY ARE YOU HERE?
  3. 3. SUPPORT IN INTELLIJ IDEA PROGRAMMING LANGUAGE FROM JETBRAINS
  4. 4. OFFICIAL SUPPORT FOR ANDROID DEVELOPMENT Google I/O 2017
  5. 5. SPRING SUPPORT https://spring.io/blog/2017/01/04/introduc ing-kotlin-support-in-spring-framework-5-0 http://start.spring.io/
  6. 6. GRADLE SUPPORT Ø Use Kotlin for writing Ø Gradle Script Kotlin (build.gradle.kts) Ø Plugins Ø Benefits Ø auto-completion and content assist Ø quick documentation Ø navigation to source Ø refactoring https://blog.gradle.org/kotlin-meets-gradle https://github.com/gradle/kotlin-dsl
  7. 7. INTERESTING FACTS Started development in 2010 at Jetbrains Open sourced in 2012 First official stable release v1 - Feb 15, 2016 (current release v1.1.4 – Aug 15, 2017) Used in all Jetbrains IDEs 100% interoperable with Java Syntax is similar to Swift Influenced by Java, Scala, Groovy, C#, Gosu, JavaScript, Swift
  8. 8. TIME FOR “HELLO WORLD!” Hands-on
  9. 9. DEFAULT IMPORTS https://kotlinlang.org/docs/reference/packages.html
  10. 10. Android JVM Browser Native Kotlin • App development • Use Java 8 features with Java 6 (highest supported ver.) • Wrapper for Java • Alternative to other JVM languages Wrapper for Javascript Native code generation for different platforms incl. iOS LANDSCAPE
  11. 11. ADVANCED HELLO WORLD! Hands-on
  12. 12. VISIBILITY MODIFIERS Top level declarations (classes, functions, properties …) Modifier Visibility Public (default) world Private file Internal module Members inside a class Modifier Visibility Public (default) world Private class Protected class and sub-class Internal module
  13. 13. INTEROP WITH JAVA Hands-on
  14. 14. DATA TYPES & CONTROL FLOWS Walk through
  15. 15. CLASSES Hands-on + Walk through
  16. 16. SAMPLE CODE GITHUB REPO https://github.com/shaunthomas999/kotlin-workshop
  17. 17. CODING EXERCISE - 01 Hands-on
  18. 18. FUNCTIONS Walk through
  19. 19. CODING EXERCISE - 02 Hands-on
  20. 20. DATA CLASSES Hands-on
  21. 21. CODING EXERCISE - 03 Hands-on
  22. 22. SAMPLE SPRING-BOOT APPLICATION WITH SPRING-DATA-REST Walk through https://github.com/shaunthomas999/spring-boot-data-rest-sample
  23. 23. CREATE PROJECT Go to http://start.spring.io/
  24. 24. LET’S WORK ON THE EXERCISE NOW Hands-on
  25. 25. EXTRA KOTLIN-MAVEN-PLUGIN CONFIGURATION REQUIRED
  26. 26. ØGeneral syntax <keyword> <name>: <Type> ØThere is no ‘new’ operator in Kotlin Ø By default Kotlin classes, properties and functions are public and final Ø Everything is an object in Kotlin Ø Numbers, charcters and boolean can have primitive values at runtime Ø main() should not be inside a class
  27. 27. RESOURCES https://kotlinlang.org/community/ https://kotlinlang.org/docs/reference/
  28. 28. THANK YOU Shaun Thomas shaunthomas999@gmail.com www.shaunthomas999.com

×