Why Clojure, by uncle Bob

Agree on TDD. I think it is less needed when you have a REPL like Clojure’s. However, I use it to some extent together with the REPL. A bit like so:

  1. Hack in a comment form until I have an idea what function(s) to write/how to write it.
  2. Write a little of the function.
  3. Write some code in a comment form testing the new version of the function.
  4. Possibly repeat 2 and 3 until it works.
  5. When it works, consider adding some of the testing code in :test of the function meta data.
  6. Run tests for current function. This probably just works, but if not, go to 1 or 2 (depends).
  7. Go to 1 until done.

(I do not use the REPL prompt very much.)

Step 5 and 6 helps me improve my testbed and is why I think about it as TDD. REPL improved TDD, maybe? :smile:

3 Likes