> Markdown version of [/videos/705-tackling-complexity-with-functional-programming-and-kotlin?t=869](https://www.wearedevelopers.com/videos/705-tackling-complexity-with-functional-programming-and-kotlin?t=869). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Tackling Complexity With Functional Programming And Kotlin Ditch brittle exception handling and endless boolean flags. Discover how practical functional programming concepts in Kotlin can transform complex business requirements into readable, maintainable, and compiler-safe systems. - **Speakers:** [Georg Dresler](https://www.wearedevelopers.com/@georg) - **Event:** World Congress 2023 - **Published:** September 27, 2023 - **Duration:** 28:48 - **URL:** https://www.wearedevelopers.com/videos/705-tackling-complexity-with-functional-programming-and-kotlin ## Summary The presentation explores how developers can manage unpredictable and complex feature requests by applying functional programming concepts in Kotlin. Starting with a convoluted client scenario involving offline form editing and PDF syncing, the speaker demonstrates how typical object-oriented approaches lead to brittle, exception-heavy software. To resolve this, the narrative introduces functional programming principles not as dense academic theory, but as practical tools to improve code readability, stability, and maintainability. Key applied strategies include eliminating exceptions entirely in favor of an Either type, which enables graceful, inline error handling through higher-order functions like flatMap and fold. The speaker then tackles runtime validation safety by combining Kotlin's private constructors with companion objects, ensuring only valid data states can be instantiated. Finally, the presentation simplifies complex conditional logic—such as managing unvalidated form drafts versus finalized versions—by replacing error-prone boolean flags with Algebraic Data Types (ADTs). By utilizing Kotlin's sealed classes to represent sum types, developers can enlist the compiler to guarantee that business logic functions only receive the correct data form. Ultimately, integrating these functional methodologies equips teams to build robust, predictable systems capable of absorbing fluid requirements. **Keywords:** functional programming in kotlin, software complexity management, kotlin either type pattern, exception handling alternatives, functional error handling, flatmap and fold operations, kotlin validation patterns, private constructors in kotlin, companion object invocation, algebraic data types, kotlin sealed classes, product and sum types, eliminating boolean flags, compile-time data guarantees, arrow kt library ## Chapters 1. **Navigating complex customer requirements in software projects** (00:03) — Real-world examples of highly convoluted feature requests demonstrate the need to systematically manage application complexity. 1. **Analyzing the drawbacks of standard exception handling** (04:40) — Relying on extensive try-catch blocks forces developers to compromise between precise debugging capability and overall code readability. 1. **Replacing exceptions with the either type functional pattern** (07:18) — Utilizing a generic sealed class to explicitly represent success or failure states eliminates unpredictable runtime crashes. 1. **Chaining functional operations using flatmap and fold** (11:09) — Higher-order functions process sequential logic cleanly and route isolated errors to appropriate logging or messaging workflows. 1. **Enforcing data validation with private constructors and operators** (14:29) — Restricting object creation behind a companion object ensures models are implicitly validated before entering the core business logic. 1. **Recognizing the structural pitfalls of conditional boolean flags** (18:14) — Depending on unstructured boolean properties to track partial input states introduces fragile conditional checks across downstream functions. 1. **Controlling state complexity through algebraic data types** (20:30) — Implementing pure sum and product types allows the compiler to reject invalid structural transitions without relying on manual guardrails. 1. **Combining functional data abstraction and explicit validation** (22:51) — Merging encapsulated type structures with functional operators produces safe execution pipelines from raw drafts to validated domain artifacts. 1. **Summarizing architecture benefits and answering audience questions** (25:03) — Final reflections touch upon functional ecosystem tooling like the Arrow library and managing functional composition at scale. ## Related Moments - [Summarizing the practical engineering advantages of writing Kotlin](https://www.wearedevelopers.com/videos/661-why-kotlin-is-the-better-java-and-how-you-can-start-using-it) (from "Why Kotlin is the better Java and how you can start using it") - [Configuring runtime Java and Kotlin interoperability protocols](https://www.wearedevelopers.com/videos/661-why-kotlin-is-the-better-java-and-how-you-can-start-using-it) (from "Why Kotlin is the better Java and how you can start using it") - [Navigating Kotlin Multiplatform beyond the happy path](https://www.wearedevelopers.com/videos/100143-the-dark-corners-of-kotlin-multiplatform) (from "The Dark Corners of Kotlin Multiplatform") - [Taming declarative complexity with Kotlin Coroutines](https://www.wearedevelopers.com/videos/440-back-end-to-the-future-embracing-the-continuous-evolution-of-infrastructure-and-code) (from "Back(end) to the Future: Embracing the continuous Evolution of Infrastructure and Code") - [Live coding demonstration of Kotlin null safety](https://www.wearedevelopers.com/videos/661-why-kotlin-is-the-better-java-and-how-you-can-start-using-it) (from "Why Kotlin is the better Java and how you can start using it") - [Architectural boundaries and the Kotlin Multiplatform survival kit](https://www.wearedevelopers.com/videos/100143-the-dark-corners-of-kotlin-multiplatform) (from "The Dark Corners of Kotlin Multiplatform") ## Related Articles - [Using Java 17 latest features in real world projects](https://www.wearedevelopers.com/magazine/121-using-java-17-latest-features-in-real-world-projects) - [How to Avoid Over-Engineering](https://www.wearedevelopers.com/magazine/546-how-to-avoid-over-engineering) - [Liuba Gonta and Yuliya Khadasevic - GitHub Copilot Beyond the Basics - 10 Ways to Elevate Your Coding](https://www.wearedevelopers.com/magazine/490-liuba-gonta-and-yuliya-khadasevic-github-copilot-beyond-the-basics-10-ways-to-elevate-your-coding) - [Dev Digest 138 - Are you secure about this?](https://www.wearedevelopers.com/magazine/486-dev-digest-138-are-you-secure-about-this) ## Related Jobs - [Senior Software Engineer](https://www.wearedevelopers.com/jobs/ext/15942-senior-software-engineer) at **GitHub** - [Senior Software Engineer, Android (Earn Experience)](https://www.wearedevelopers.com/jobs/ext/1937627-senior-software-engineer-android-earn-experience) at **Bitpanda** - [Senior Backend Engineer (Java)](https://www.wearedevelopers.com/jobs/ext/19369-senior-backend-engineer-java) at **Bonial International GmbH** - [Principal Software Engineer, Database Infrastructure](https://www.wearedevelopers.com/jobs/ext/1465908-principal-software-engineer-database-infrastructure) at **GitHub** - [Senior Software Engineer, Client Apps Platform](https://www.wearedevelopers.com/jobs/ext/1773893-senior-software-engineer-client-apps-platform) at **GitHub** - [Lead Software Engineer (f/m/d)](https://www.wearedevelopers.com/jobs/48296-lead-software-engineer-f-m-d) at **Personio SE & Co. KG**