Philly ETE 2015 – Jessica Kerr – Contracts and Clojure: The Best-Yet Compromise Between Types and Tests

Tags: , , ,

Download (PDF, 3.87MB)


Clojure makes highly functional programming fun… until it isn’t. Runtime type errors from a function that was returned from another function? I’m longing for Scala’s compiler errors! Nested maps of data make testing easier… until “Wait, what’s in there again?” What I want is a little bit of typing in strategic places: enter Prismatic’s Schema library. What look like types are really contracts. They’re even more powerful than types: they verify values as well as shapes. Exercised in generative tests, these contracts satisfy my type cravings without the pain of satisfying a compiler. There are limitations; schemas can’t express relationships between input and output types… or can they? Schemas don’t express parameterized types… or can they? Explore the potential of contracts as the best-yet compromise between types and tests. No Clojure experience (or interest) needed.

About Jessica:

Jessica Kerr is a static-typing fan working in a dynamic language.

She writes Clojure full-time for Outpace, after a few years in Scala and a decade in Java. As time allows, she speaks about functional programming in the US and Europe, blogs, tweets, teaches for Pluralsight, and raises two daughters. Her side projects include measuring pain, categorizing yaks, and defining “quality.”