# John Hughes - How to specify it! A guide to writing properties of pure functions | Code Mesh LDN 19

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

[Code Sync](https://www.youtube.com/@CodeSync) · Published 2019-12-06 · 43:56 · A tier · Systems thinking

[Watch on YouTube](https://www.youtube.com/watch?v=zvRAyq5wj38) · [All RatTube videos](/tube)

## Summary

John Hughes explains how to write [properties](/lore/property-based-testing) for pure functions rather than collecting more examples. Generated inputs exercise a rule, and shrinking reduces a failure to a small case in which each part matters.

He shows why generators also need checks: invalid generated trees can confuse the [properties](/lore/property-based-testing) that consume them. The talk explores describing how output should change when input changes and comparing an implementation with an abstract model.

## Section notes

- [1:06](https://www.youtube.com/watch?v=zvRAyq5wj38\&t=66s): A reverse function introduces generated inputs and properties.
- [7:45](https://www.youtube.com/watch?v=zvRAyq5wj38\&t=465s): Shrinking finds a small counterexample relevant to the failure.
- [15:24](https://www.youtube.com/watch?v=zvRAyq5wj38\&t=924s): Generators must produce valid inputs and need properties of their own.
- [23:49](https://www.youtube.com/watch?v=zvRAyq5wj38\&t=1429s): Changing an input can predict how a result should change without predicting the whole result.
- [31:24](https://www.youtube.com/watch?v=zvRAyq5wj38\&t=1884s): Abstract data representations provide models for testing implementations.
- [39:11](https://www.youtube.com/watch?v=zvRAyq5wj38\&t=2351s): The closing comparison considers the effectiveness of input-change properties and models.

## Key concepts

- [properties](/lore/property-based-testing)

## Our take

John Hughes gives five strategies for finding properties of pure functions, compares how well each finds bugs, and names the biggest pitfall. The practical companion to the talk above.

## Related videos

- [John Hughes - Testing the Hard Stuff and Staying Sane](/tube/testing-hard-stuff-john-hughes)
- [All Code Is Slop (Except Mine) — Lauren Tan, SpaceXSI](/tube/all-code-is-slop-except-mine-lauren-tan)
- ["Simple Made Easy" - Rich Hickey (2011)](/tube/simple-made-easy-rich-hickey-2011)
- [Leslie Lamport: Thinking Above the Code](/tube/leslie-lamport-thinking-above-the-code)

Summary based on the transcript. Written 2026-11-15.
