Effective Kotlin

BEST PRACTICES

During this 2 or 3-day workshop for experienced Kotlin developers, we'll dive deeply into Kotlin's best practices and idiomatic Kotlin use. We'll also talk about more general concepts like readability, abstraction design or contract setting.

The workshop is based on the Effective Kotlin book. The content is well thought out and consulted with many Kotlin developers.

On the workshop you will

Learn from lecture supported by slides

Solve coding challenges

Complete practical exercises

Solve puzzlers

During the workshop we cover:

In the first 2 days, we cover general best practices and class design, and the 3rd day is dedicated to code efficiency.

The most important best practices we'll be covering are:

Safety

  • Limit mutability
  • Eliminate platform types as soon as possible
  • Do not expose inferred types
  • Prefer composition over inheritance
  • Make it clear that top-level functions are not member functions

Readability

  • Design for readability
  • Use operator overloading methods as their names indicate
  • Consider naming arguments
  • Avoid returning or operating on Unit?
  • Specify variable type when it is not clear
  • Consider referencing receiver explicitly

Reusability

  • Do not repeat knowledge
  • Do not repeat common algorithms
  • Reuse between different platforms by extracting common modules

Design abstractions

  • Each function should be written in terms of a single level of abstraction
  • Define abstractions
  • Respect abstraction contract
  • Restrict visibility
  • Use abstraction to protect code against changes
  • Consider wrapping external API

Objects creation

  • Consider factory functions instead of constructors
  • Consider primary constructor with named optional arguments
  • Consider defining DSL for complex object creation

Class design

  • Use data modifier to represent a bundle of data
  • Use function types instead of interfaces to pass operations and actions
  • Do not use properties to express behavior
  • Respect contract of equals
  • Respect contract of hashCode
  • Respect contract of compareTo
  • Respect contract of arithmetic operators

Make it cheap

  • Avoid unnecessary object creation
  • Consider inline modifier for higher-order functions
  • Eliminate obsolete object references
  • Use tail recursion to achieve efficient recurrence

Efficient collection processing

  • Prefer Sequence for bigger collections with more than one processing step
  • Consider Arrays with primitives for performance critical processing
  • Consider using mutable collections

On this way, we'll also review more advanced topics including:

  • Collections
  • Delegates
  • Platform types
  • Interoperability with Java
  • Typing system
  • Generics
  • Operator overloading
  • DSL creation
  • Functional programming

During the 3rd day we additionally cover:

  • Inline classes
  • Computational complexity

How long does it take?

This full workshop lasts 3 days, but we also offer tailor-made options that can take 1 or 2 days.

Requirements

  • Fluent use of Kotlin
  • Computer with IDEA IntelliJ installed
Marcin Moskała

Marcin Moskała

Marcin Moskala is an experienced developer and Kotlin trainer. He is the founder of the Kt. Academy, an official JetBrains partner for Kotlin training, author of the books Effective Kotlin, Kotlin Coroutines, Functional Kotlin and Android Development with Kotlin. He is also the main author of the biggest medium publication about Kotlin and a speaker invited to many programming conferences.

One of the first certified Kotlin training worldwide

You will be trained by an expert who is an official JetBrains' Kotlin training partner. The quality of his workshops was checked and certified by the creators of the Kotlin language itself.

JetBrains certified Kotlin Training

Register

Choose this option if you need a workshop for your team or company. The basic price is 5000 EUR for the group for 3 days.

Reserve now

Choose this option if you need a workshop for yourself or for a small group of people. The basic price is 400 EUR per person for the whole workshop.

Reserve now

Our experts offer consultations for both companies and individuals. The price is set individually.

Contact us