Programming in Kotlin: Functions & Custom Types

Take a deeper look at the Kotlin programming language! Explore the intricacies of functions, lambdas, classes, objects, interfaces, and more. By Catie Catterwaul.

3 (2) · 2 Reviews

Download materials
Save for later
Comments
Share

Learning path

This is part of the Android & Kotlin for Beginners learning path. View path.

Who is this for?

This course is part of our Android and Kotlin for Beginners learning path. You’re ready for this course if you’re working through that learning path in order, or you’re someone who has some experience programming in Kotlin.

To start, you’ll review some function and lambda fundamentals. You’ll also practice writing lambdas and using them to manipulate collections.

Then, you’ll move on to build your skills in writing custom types: classes, interfaces, enum classes, and more. You’ll learn about features they share, and some of the functionality that makes each unique.

Throughout the course, you’ll practice everything you learn with hands-on challenges. Ready? Let’s get started!

Covered concepts

  • Lambdas
  • Higher-Order Functions
  • Custom Accessors
  • Delegated Properties
  • Methods
  • Companion Object Properties & Methods
  • Extension Properties & Methods
  • Class Inheritance
  • Polymorphism
  • Constructors
  • Interfaces
  • Objects
  • Enum Classes
  • When Expressions
  • Sealed Classes

Part 1: Lambdas & Higher-Order Functions

01
Toggle description

Welcome to Programming in Kotlin: Functions and Custom Types! In this episode, find out what this course has in store for you.

Toggle description

Review some fundamentals about how functions and lambdas work, as well as their various syntax options.

Toggle description

Find out about how lambdas capture data and how they relate to the concept of higher-order functions.

Toggle description

Find out how writing lambdas can help you handle collections with two common alternatives to for loops: forEach and map!

Toggle description

Practice what you have learned about using lambdas and collections with this series of hands-on coding challenges.

Conclusion 5:54
Toggle description

Review what you’ve learned so far, and use six higher-order functions in a row in this fast-paced Part 1 finale!

Part 2: Properties & Methods

Toggle description

In this part of the course, you’ll study some features shared by named types in Kotlin: properties and methods!

Toggle description

In this episode, learn about a different kind of property that is recomputed every time it is accessed.

Toggle description

Companion objects are Kotlin’s answer to static members. In this episode, find out what they can do for your custom types.

Practice everything you have learned about properties with custom accessors, and using companion objects.

Toggle description

Learn how to use delegated properties to observe property changes, delay the initialization of a property, and more!

Toggle description

Practice using what you’ve learned about different kinds of delegated properties in this series of hands-on challenges.

Methods 4:29
Toggle description

Take another look at methods in Kotlin. Learn when to reach for a method, or turn to property accessors.

Toggle description

Kotlin uses extension properties and methods to let you augment a type without changing the class definition.

Toggle description

Practice using everything you have learned about methods and extension properties and methods with hands-on challenges.

Conclusion 1:06
Toggle description

Review what you learned about properties and methods in this part of the course, and find out what’s up next.

Part 3: Class Inheritance & Interfaces

Toggle description

In this part of the course, learn how to use subclassing and interface adoption to let types inherit functionality.

Toggle description

Learn about an important and powerful feature of classes that lets one class inherit functionality from another class.

Overriding 5:16
Toggle description

When working with a class hierarchy, subclasses can have their own implementations of a parent’s properties and methods.

Toggle description

Depending on the context, a subclass can be treated as its own type, or, as one of its superclasses.

Toggle description

Learn how to use primary and secondary constructors, and how subclassing affects class initialization.

Toggle description

Practice using all of the things you’ve learned about classes so far in this open-ended, hands-on challenge!

Interfaces 11:48
Toggle description

Learn how to make your types conform to interfaces in Kotlin, which you can think of as a to-do list for your types.

Toggle description

Practice using interfaces instead of class inheritance in the final challenge of this part of the course.

Toggle description

In this episode, learn five things to consider when you’re trying to decide between subclassing and using an interface.

Conclusion 0:51
Toggle description

Review the key points you’ve learned about class inheritance and interfaces, and check out what’s next.

Part 4: Objects, Enum Classes & Sealed Classes

Toggle description

Ready to learn about some specialized types in Kotlin: Objects, Enum Classes, and Sealed Classes? Let’s dive in!

Objects 5:11
Toggle description

Kotlin introduces a new keyword that is unavailable in the other languages to which it is often compared.

Toggle description

Learn how to use Enum Classes to represent a specific set of related, discrete values like days of the week!

Toggle description

One of the most powerful features of Enum Classes in Kotlin is how they combine with the when expression.

Toggle description

Practice everything you’ve learned about Enum Classes and when expressions in this hands-on challenge.

Toggle description

A Sealed Class is a special type of class that combine aspects of Enum Classes, class inheritance, and interfaces.

Toggle description

Challenge time! Practice using Sets to store unique pieces of data by solving this challenge.

Conclusion 0:48
Toggle description

Congratulations on finishing the course - you’ve learned a ton of new Kotlin concepts! In this episode, find out where to go next to continue your journey.