Back to Browse

Double Dispatch: Prelude to the Visitor Pattern

4.6K views
Premiered Apr 23, 2025
11:15

One reason the Visitor Pattern can feel confusing is because of double dispatch. So before we dive into the Visitor Pattern itself, let’s take a closer look at double dispatch—what it is, how it’s traditionally handled in single-dispatch languages, and how a few Kotlin language features can make it much simpler. 📘 My book, Kotlin: An Illustrated Guide is now available in paperback! https://www.amazon.com/Kotlin-Illustrated-Guide-Dave-Leeds/dp/B0F3Q1DKGX/ ✨ New to Kotlin? Start your journey here: https://typealias.com/start/ 🚀 Get the inside scoop on everything I'm working on - join my new email newsletter! Sign up here: https://newsletter.typealias.com/ 👨🏽‍💻 Source code for today's video: https://github.com/typealias-studios/video-2025-04-double-dispatch 📚 Chapters 00:00 Introduction 00:36 Dispatch and Multiple Dispatch 04:38 Simulating Double Dispatch in Kotlin 08:01 A Simpler Approach 09:48 Wrap-up

Download

1 formats

Video Formats

360pmp419.8 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Double Dispatch: Prelude to the Visitor Pattern | NatokHD