Types in programming languages protect us from doing mistakes. It depends on the chosen language how strict and often these type checks are performed. One code smell you may have heard of is called “Primitive Obsession.” It occurs when you are relying too much on built-in data types like integers and strings. Type systems gained a lot of power over the last decades. Many programming languages allow us to embed business rules and security properties directly into types. This enables the compiler to statically enforce these rules. Preventing mistakes and vulnerabilities by design is our goal.
In this talk I will show you a couple of examples how to encode business work flows and constraints into types. The examples will be in a variety of programming language, demonstrating the wide applicability of this approach.