Kotlin Training Certified by JetBrains

Course Format

The format of the course will be two days of Kotlin fundamentals (via Instil’s Kotlin certified language course) followed by two days instruction in Pure Functional Programming (via 47 Degrees Arrow workshop).

By the end of the delivery delegates will be able to program using all the features of the Kotlin language, but in particular have a detailed knowledge of advanced Functional Programming using Pure Functions, Immutable Data, Higher Kinded Types and Effects.

The course is comprised of 32 hours of material designed to take you from zero knowledge, to the ability to use Functional Programming in Kotlin with Arrow to build functional apps.

Instil Software

Kotlin Fundamentals Outline

Days 1 and 2 of the course will cover the basics of programming in Kotlin:

Introducing Kotlin on the JVM

  • Four coding paradigms within Java 9
  • Limits imposed by backwards compatibility
  • The new consenses in language design
  • A brief history of the Kotlin language
  • Comparing Kotlin to Scala and Clojure
  • Comparing Kotlin to Swift and TypeScript

First Steps with Kotlin

  • Declarations and type inference
  • The Kotlin type system and conversions
  • Packages, access levels and default imports
  • Nullable types and operators for null safety
  • Keywords for selection and iteration
  • Options for declaring basic functions
  • Overloading, infix functions and ranges

Object Orientation

  • Decompiling Kotlin classes using ‘javap’
  • Understanding properties and backing fields
  • A detailed explanation of primary constructors
  • Adding extra fields and secondary constructors
  • Extra features automatically added to data classes
  • Overriding, abstract classes and interfaces
  • Using object expressions as event handlers
  • Object declarations and companion objects

Generic and Type Parameters

  • Revision of covariance and contravariance
  • Common issues with bounded wildcards in Java
  • How declaration site variance simplifies generics
  • Support for use-site variance (aka type projection)
  • Declaring single and multiple constraints on types

Work with Collections Part 1

  • Introducing the Kotlin collections library
  • Working with mutable and immutable collections
  • Support for destructing types and collections

Functional Programming

  • Working with function references and code blocks
  • Declaring functions as parameters and return types
  • Using higher order functions for internal iteration
  • Creating your own versions of ‘filter’, ‘map’ etc…
  • Using higher order functions to prevent duplication
  • Understanding partial invocation and currying
  • Choosing between code blocks and local functions
  • Common misunderstandings regarding enclosure

Working with Collections Part 2

  • Basic coding using ‘filter’, ‘map’ and ‘forEach’
  • Testing against a predicate using ‘all’, ‘any’ etc…
  • Why ‘flatMap’ is such as valuable operation in FP
  • Distinguishing between ‘fold’, ‘foldRight’ and ‘reduce’
  • Converting between collection types within FP

Interoperability Between Kotlin and Java

  • General guidelines for mixed language codebases
  • Considerations when calling Java libraries from Kotlin
  • Obtaining and using java.lang.Class objects in Kotlin
  • Tips and idioms for calling Kotlin libraries from Java code
47 Degrees

Introduction to Functional Programming in Kotlin Outline

Days 3 & 4 of the course will cover Functional Programming in Kotlin with the Arrow open source library.

Functional Programming 101

  • Pure Functions
  • Referential Transparency
  • The Substitution Model
  • Higher Order Functions

Domain modeling with Algebraic Data Types

  • Data classes and product types
  • Sealed classes and co-product types

Basic Error Handling and Data validation

  • Option
  • Try
  • Either
  • Validated
  • Fail Fast and Error accumulating Failure modes

Working with Immutable Data with Optics

  • Focusing on deeply nested data with Lens, Prism and Optional
  • Removing boilerplate with the Optics DSL

Types of higher kind

  • Introduction to polymorphic programs
  • What are Higher Kinded Types?
  • Polymorphic functions
  • Generalized Algebraic Data Types
  • Generalizing folds and unfolds with Recursion Schemes

Programming with the core functional type classes

  • Modeling Generic Behaviors with Type Classes
  • Transforming data with Functor
  • Independent computations with Applicative
  • Dependent Computations with Monad
  • Folding structures into summary values with Foldable
  • Traversing nested effects
  • Lawful and Lawless instances

Polymorphic Error Handling

  • Modeling and raising errors
  • Fail Fast and Error Accumulating strategies with ApplicativeError and MonadError

The issue of nested effects and monad transformers

  • Dependency Injection alternative with Reader, Kleisli, Extension Functions
  • Removing Callback-Hell and nested lambdas
  • Encoding alternatives with Free Monads and Stack Safe Free Algebras
  • The rise of Tagless Final

Working with Tagless Final & Async Effects

  • Suspending side effects for deferred evaluation
  • Safe resource acquisition and release
  • Integrating with third-party sync and async libraries
  • Testing Effectful Tagless Final programs

Requirements

No prior experience of Kotlin is required, but delegates should have at least five years of Java programming experience. This is a fast paced delivery with delegates spending most of their time examining and then extending sample code. Experienced Kotlin developers may wish to attend only the second part of the delivery, which is acceptable provided they can can demonstrate their existing knowledge is sufficient.