Design by Contract in Elixir: “Let it crash” meets ...
summary
Claims that Design by Contract is practical in Elixir by using metaprogramming to inject assertions, demonstrates a working library that redefines def to add requires/ensures tags via Elixir macros (quote/unquote), and runs a concrete tank fill/empty demo where a precondition failure blames the caller and a postcondition failure reveals a buggy implementation. Library lives as ElixirContracts on GitHub, currently works for the demo but is a work in progress—needs test-case generation, runtime toggles, docs and QuickCheck integration.
AI-written summary · about
chapters (19)
- 0:00Start
- 1:53Did you know?
- 4:44What happened?
- 7:01History
- 7:41Basics of Hoare logic
- 8:49DbC vs. Testing
- 9:33What is Design by Contract?
- 10:45Structure of a contract
- 11:31Example
- 12:39in Ariane's case
- 14:16Advantages
- 14:55Language support
- 15:24Metaprogramming In Elixir
- 16:07Macros Rules
- 18:54Quote Macro
- 20:17Back to DbC
- 26:46FURTHER WORK
- 27:15To conclude
- 27:58References
related talks
32mDesign by Contract in Elixir(...)
38mTesting with Elixir/Erlang
41mFixing Design with Tests
33mLets Generate Tests
37mBreaking the bank with test contract
39mPainless Test Driven Development with Elixir and Phoenix
42mDesign Driven Concepts for Automated Testing
47mTesting the Hard Stuff and Staying Sane
