I use (comment ,,,)
for lists of expressions that I can evaluate from my editor – aka “Rich Comment Forms” (coined by Stu Halloway, I believe, because Rich Hickey uses this technique to have “dev/test” expressions saved in a source file – you can find it in some part of the Clojure source itself).
A comment
form can contain multiple pieces of code and overall it “evaluates” to nil
(without executing any of the code). The #_
reader macro causes a single expression to be completely ignored.
[1 2 3 (comment 4) 5 #_6 7]
;;=> [1 2 3 nil 5 7]
I use a mixture of RDD and TDD. I’ll use TDD when I have a requirements spec for a new feature that lends itself easily to writing tests, e.g., a new API endpoint for our REST service. I’ll write (failing) tests for all the error handling cases and several happy path cases, and implement code to make the tests pass, one or two tests at a time. I’ll use RDD most of the time (even when I’m also doing TDD) using comment
forms to explore data structures and transforms, as I evolve code to the point it does what I need.
Some of those comment
forms will also become actual tests so that we have protection against regressions.
Our code base runs about 95K lines right now. 21K of those are tests of various sorts (some UAT-style, some unit, some integration, some generative and/or property-based).