Type-Driven Design in Swift

This presentation will demonstrate how to harness the power of Swift’s advanced type system and make it a powerful ally and assistant.

The attendees will develop a mental model that prioritises Types before Code, enabling them to capture essential product requirements early in the development process. The attendees will be gently introduced to functional programming concepts such as “making impossible state unrepresentable”, “types as propositions, values as proofs”, among others, through the process of refactoring of a simple “Log In” module.

The session will begin with a straightforward and naïve implementation of a typical “Log In” experience, including email and password validation, and an authentication network request. We will discuss weaknesses of the initial implementation and then refactor it using type-driven techniques.

After the attendees have acquired a basic understanding of type-driven design, we will go back to the first principles and examine a simplified theory that supports type-driven design logically.

We will then examine different types of functions (partial vs. total, pure vs. side-effectful), and learn straightforward refactoring techniques to produce highly testable and type-safe code.

Finally, we will bring everything into perspective by examining the relationship between types and tests and where they fit in the typical “Testing Pyramid.”

Share

Session info:

Speaker: Alex Ozun

Senior iOS Engineer @ American Express at American Express

Date: 12 May 2023

Time: 14:10 - 14:55

Relevant tags:
iOS Swift

See all speakers

See all videos