Making illegal states unrepresentable
Monthly articles on advanced Swift topics, functional programming, and software design.
New Collection ๐
Type-Driven Design with Swift
Articles
Subscribe via RSSMaking illegal states unrepresentable
Domain modeling with types
Witness pattern โ type-safe access control
Type-safe validation
Fundamentals of type-driven code
With this series of articles, I have a lofty goal of shifting your Swift programming mindset. I know it sounds presumptuous, but this is exactly what happened to me a few years back when I was introduced to Type-Driven Design. I assure you, itโs not some new fad or an esoteric methodology. Itโs a system of practical, well-researched, and time-tested ideas that form the basis for a powerful approach to writing high-quality, robust, and correct software.
Typestate - the new Design Pattern in Swift 5.9
Greater type safety with Structural Typing in Swift
In this article I will show you how to achieve a strong compile-time guarantee that your code is correct. I will demonstrate how the internal structure of your types can hold unbreakable rules within them, known as invariants. Through real-world examples such as NonEmptyArray
, Zipper
, and UUID
, I'll try to convince you to view the structure of your types through the lens of type safety, ultimately levelling up your Swift programming skills.