Domain Model Validation In Kotlin: Part 1
Inline classes: more type-safety for less runtime overhead
The Framework
Tiberiu Tofan
Running on JVM for more than 20 years, navigating between Java, Groovy, Scala, and Kotlin. I focus on maintainable code, continuous delivery, and functional programming principles—from architecture to automated pipelines and testing.
A deep-dive technical talk about reclaiming control over your architecture, your boundaries, and your domain. It challenges the "default" layered mindset and shows how functional principles—explicit data modeling, typed error handling, clear boundaries, and inversion of control—help you design systems that are predictable, testable, and framework-agnostic.
The talk follows a practical, step-by-step refactoring of a real application, built twice:
Through animated examples, visual metaphors, and progressive refactorings, you'll see how design choices ripple through your codebase—from domain modeling to error handling, from integration boundaries to testing strategy.
Small, functional interfaces simplify testing and maintainability.
Use domain-specific types for clarity, validation, and type safety.
Represent errors explicitly with domain-friendly Result/Either types—no hidden exceptions.
Decouple from infrastructure/frameworks and ensure your domain invariants are always protected.
The complete working example demonstrating all concepts from the talk, implemented in both Java and Kotlin.
Full talk on functional principles with Java sealed interfaces and records, delivered at ING Hubs Romania Hangouts.
Recorded on the JavaCon track at DevCon 2025, Bucharest — Nov 5, 2025.
Kotlin Version
Coming soon...
Deep dive into domain modeling in Kotlin - a comprehensive series on validation, type safety, and inline classes.
Inline classes: more type-safety for less runtime overhead
Don't fail fast; fail comprehensively
Validations within a context
Writing an (almost) functional app in an (almost) functional way