A quick guide to Kotlin's syntax and semantics
Ken Kousen walks you through the basic syntax and standard idioms for writing and executing Kotlin programs. You'll learn about installation and execution options, object-oriented and functional programming techniques, basic data types, collections, and more.
What you'll learn-and how you can apply it
By the end of this live, online course, you’ll understand:
- How to install the Kotlin compiler and execution environments
- How to decide between nullable and non-nullable types
- Where to find the provided documentation and how to use it
And you’ll be able to:
- Read and write basic Kotlin programs
- Distinguish between classes and object singletons
- Write functions, classes, and objects in Kotlin
- Work with collections
- Use conditional expressions like "if" and "when"
- Employ basic functional concepts like map, filter, and reduce
This training course is for you because...
- You're a Java developer who wants to simplify your code while retaining safety as a primary goal.
- You're planning to do Android development and are familiar with its basic principles.
- You're an architect trying to decide whether Kotlin should be supported in your organization.
- A working knowledge of object-oriented programming concepts, preferably in Java (such as in Java 7 or above)
- Familiarity with functional concepts like streams, lambdas, and method references (such as in Java 8 or above) (useful but not required)
- A machine with IntelliJ IDEA (either the free Community edition or the commercial Ultimate edition) or Android Studio installed
About your instructor
Ken Kousen is the author of the books Kotlin Cookbook (O'Reilly), Modern Java Recipes (O'Reilly), Gradle Recipes for Android (O’Reilly) and Making Java Groovy (Manning), as well as O’Reilly video courses in Android, Groovy, Gradle, Advanced Java, and Spring. Ken is a Java Champion. He is a regular speaker on the No Fluff, Just Stuff conference tour and a JavaOne Rock Star, and has spoken at conferences all over the world. Through his company, Kousen I.T., Inc., he has taught software development training courses to thousands of students.
The timeframes are only estimates and may vary according to how the class is progressing
Installing and running Kotlin (30 minutes)
- Lecture and hands-on exercises: Installation options; cloning the sample repository; command-line tools; using the REPL; compiling and executing Kotlin programs; using build tools like Maven and Gradle; IDE support
Kotlin basics (45 minutes)
- Lecture and hands-on exercises: Deciding between var and val types; declaring variables to be nullable; defining top-level functions; defining classes and interfaces; creating object singletons; reference equality and object equivalence
- Break (15 minutes)
Collections and arrays (30 minutes)
- Lecture and hands-on exercises: Mutable and immutable collections; creating arrays; common collection methods; read-only collections; grouping and associating values
Functional concepts (45 minutes)
- Lecture and hands-on exercises: Lambda expressions; function references; mapping and filtering; reduction operations; sequences and lazy evaluation
- Break (15 minutes)
Data classes (30 minutes)
- Lecture and hands-on exercises: Defining data classes; generated methods; the copy() function; accessing components
Interacting with Java (25 minutes)
- Lecture and hands-on exercises: Decompiling Kotlin bytecodes; companion objects and static; primitive types and wrapper classes; working with platform types; generating function overloads; changing generated class names
Wrap-up, Q&A, and resources for further learning (5 minutes)