Author profile picture

May 2023

The 13th chapter of Kotlin: An Illustrated Guide is about class delegation, and it’s ready for you now! Hope you like it!

As you probably know, I’ve also been creating some YouTube videos lately, so I updated the list of articles on the website here to include both the articles and links to those videos. I’ve got plans for a few more quality-of-life updates for the website, too, so you’ll see a few things shifting around here over the next few weeks.

Latest Articles and Videos

Introduction to Collection Builders

Use Collection Builders to dynamically build out a collection's contents, without leaving it open to modifications.

Introduction to Collection Builders

Smart Casts with Kotlin Contracts

Use the experimental Contracts feature to create a Smart Cast from your own function.

Smart Casts with Kotlin Contracts

Introduction to Class Delegation

Use Kotlin’s class delegation feature to forward function calls from one object to another - without all the usual boilerplate!

Introduction to Class Delegation

Easy SharedPreferences with Delegated Properties

Learn how Kotlin's delegated properties work by turning Android's SharedPreferences into a delegate.

Easy SharedPreferences with Delegated Properties

5 Fun Ways to Use Extension Functions

Let's put extension functions together with operator function conventions to do some crazy things!

5 Fun Ways to Use Extension Functions

5-Year Celebration: Peek Behind the Scenes!

Get a peek behind the scenes, including my art setup, my writing tooling, and even my cute dog!

5-Year Celebration: Peek Behind the Scenes!

Introduction to Interfaces

In Kotlin, interfaces are one way to give a class more than one type at the same time. In this chapter, learn about interfaces and implementations, plus smart casts, interface inheritance, multiple interfaces, and default implementations.

Introduction to Interfaces

Scopes and Scope Functions

Kotlin's scope functions - with(), run(), let(), also(), and apply() - introduce a new scope where an object can be easily used. Learn about two different kinds of scopes and how they affect visibility. Then, explore all five scope functions, and learn how shadowing affects implicit receivers.

Scopes and Scope Functions

Receivers and Extensions

Use Kotlin extensions to add new functions and properties to existing classes - even to classes that you didn't write! Learn all about explicit receivers, implicit receivers, extension functions, and extension properties in this chapter.

Receivers and Extensions

Collections: Maps

Maps in Kotlin are used to associate keys and values. In this chapter, we'll learn all about them, including mutable and immutable maps, map operations like forEach() and filter(), and how to convert lists into maps with associate() and groupBy().

Collections: Maps

Collections: Lists and Sets

Kotlin collections give you powerful control over groups of objects. In this chapter, we'll look at List and Set collection types, and we'll learn about collection operations - including mapping, filtering, and sorting.

Collections: Lists and Sets

Lambdas and Function References

In Kotlin, you can pass a chunk of code from one function to another. In this chapter, we'll learn how to do that, covering topics like function types, function references, lambdas, higher-order functions, and much more.

Lambdas and Function References

Nulls and Null Safety

In Kotlin, null safety is a first-class concept. In this chapter, we'll learn all about nulls, including how to manage them with tools like smart casts, elvis operators, safe-call operators, and more.

Nulls and Null Safety

Enum Classes in Kotlin

Enumeration classes can improve your code by limiting values to only those that could be correct. In this chapter, we'll learn all about enum classes in Kotlin!

Enum Classes in Kotlin

Examples of Classes in Kotlin

A quick reference that shows how to create classes in Kotlin, with examples that include properties, functions, inheritance, generics, and more.

Examples of Classes in Kotlin

Introduction to Classes and Objects

Classes and objects are everywhere in Kotlin! In this chapter, we'll put variables and functions together to create our very own types, using Kotlin classes.

Introduction to Classes and Objects

Kotlin Conditionals: When and If

Kotlin has two important conditionals: when and if. They can be used either as expressions or as statements. In this chapter, we'll use illustrations and examples to demonstrate how to use them.

Kotlin Conditionals: When and If

Functions

Learn all about Kotlin functions the fun and easy way, with lots of examples and illustrations! Expression bodies, block bodies, named arguments, default arguments, and lots more.

Functions

Variables, Expressions, and Types

So you want to be a Kotlin programmer? You've come to the right place! Your adventure starts here in Chapter 1, where you'll learn all about variables, expressions, and types.

Variables, Expressions, and Types

When to Use Sequences

When should you use Kotlin sequences? And when should you use normal collections? In this article, we'll look at some of the characteristics that can have the biggest impact on performance.

When to Use Sequences

Inside Sequences: Create Your Own Sequence Operations

Learn how to create your very own sequence operation by understanding how Kotlin's sequences work on the inside.

Inside Sequences: Create Your Own Sequence Operations

Kotlin Sequences: An Illustrated Guide

An illustrated introduction to Sequences in Kotlin - easy-to-understand diagrams that demonstrate the difference between regular collection operations and sequence operations.

Kotlin Sequences: An Illustrated Guide
Updated!

Inline Classes and Autoboxing (Updated for Kotlin 1.5+)

Get the best performance out of Kotlin's Inline Classes feature by understanding when they're inlined and when they're autoboxed.

Inline Classes and Autoboxing (Updated for Kotlin 1.5+)
Updated!

An Introduction to Inline Classes (Updated for Kotlin 1.5+)

An introduction to Kotlin's inline value classes, which can give you strong types for simple values - without sacrificing performance.

An Introduction to Inline Classes (Updated for Kotlin 1.5+)

How to Enable Kotlin 1.3 Inline Classes Today

How to configure your IDE to use Kotlin 1.3 early access so that you can start exploring inline classes and other new features. Includes instructions for Gradle, Maven, IntelliJ IDEA, and Android Studio.

How to Enable Kotlin 1.3 Inline Classes Today

Parameters and Arguments: An Easy Way to Remember the Difference

Parameters and arguments aren't the same thing. Here's an easy way to remember the difference.

Parameters and Arguments: An Easy Way to Remember the Difference

All About Type Aliases in Kotlin

Kotlin's type aliases give you a quick and easy way to create simple, concise, and domain-specific names for types. This guide covers all of the essential concepts, with plenty of examples to help you level up your Kotlin game.

All About Type Aliases in Kotlin

Star-Projections and How They Work

What are star-projections in Kotlin? And why do they change your function parameter and return types? With just two easy-to-understand rules, we can illuminate star-projections and understand exactly why they work like they do.

Star-Projections and How They Work

The Ins and Outs of Generic Variance in Kotlin

The ultimate guide to understanding generics, covariance, contravariance, and type projections in Kotlin. Learn two simple subtyping rules that explain why generic variance works the way that it does.

The Ins and Outs of Generic Variance in Kotlin

An Illustrated Guide to Covariance and Contravariance in Kotlin

Confused about generic subtyping? With just a few simple, foundational concepts, almost everything about variance becomes clear. If you're confused about how subtyping works with generics in Kotlin, start here.

An Illustrated Guide to Covariance and Contravariance in Kotlin