Clojure Culture Question on TDD

348 views
Skip to first unread message

Daniel Hinojosa

unread,
Mar 24, 2015, 10:53:44 PM3/24/15
to clo...@googlegroups.com
What is TDD culture in Clojure like? Is it strong in the community and other projects?  I am aware of Rich Hickey's guard rail analogy. Did that have an effect on how Clojurists view TDD or testing in general? Just asking for my own personal research.

Michael Blume

unread,
Mar 24, 2015, 11:37:49 PM3/24/15
to clo...@googlegroups.com
It is rare to see an open source clojure project without tests. Clojure itself is pretty thoroughly tested, as is leiningen. I don't know about test-first. I think it's actually more common to see "REPL-first" -- build something through exploration in the REPL and then turn whatever you did in the REPL into a unit test.

On Tue, Mar 24, 2015 at 7:53 PM Daniel Hinojosa <dh.evolu...@gmail.com> wrote:
What is TDD culture in Clojure like? Is it strong in the community and other projects?  I am aware of Rich Hickey's guard rail analogy. Did that have an effect on how Clojurists view TDD or testing in general? Just asking for my own personal research.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mikera

unread,
Mar 24, 2015, 11:41:14 PM3/24/15
to clo...@googlegroups.com
Guess this is somewhat a personal perspective, but here are some thoughts on testing in Clojure:

- People do a lot of automated testing in general and there are some great testing libraries available (e.g. test.check)
- People tend not to strictly follow "Test Driven Development" practices. e.g. in my experience, tests are usually added after the fact (I think Rich's guard rail analogy is more a criticism of TDD rather than testing in general)
- Writing in idiomatic Clojure in functional style is a big plus for testing (much easier to test pure functions and immutable data structures).
- Lack of static typing is a big minus (you often have to write tests to verify properties that even a fairly simple static type system would have caught for you). core.typed may alleviate this, though at the cost of extra code and build complexity.
- There is some very good integration with the CI tools (CircleCI etc.) that you can take advantage of
- If you are trying to test whole systems with state, rather than just just individual bits of code, then you should look at the mocking capabilities in stuartsierra/component
- A lot of testing during development is done informally at the REPL. There is a risk that people get a bit lazy about converting these into proper tests later, but on average the convenience and quick feedback of REPL usage is a big win.

Hildeberto Mendonça

unread,
Mar 25, 2015, 8:14:53 AM3/25/15
to clo...@googlegroups.com
BTW, BeClojure (http://beclojure.org/) is organizing an event about tests today, in Hasselt. Those living in Belgium can register at http://www.meetup.com/BeClojure/

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Hildeberto Mendonça, Ph.D
Blog: http://www.hildeberto.com
Community: http://www.cejug.net
Twitter: https://twitter.com/htmfilho

Sebastian Bensusan

unread,
Mar 26, 2015, 5:07:44 AM3/26/15
to clo...@googlegroups.com
Hi Daniel,

I believe the point of the analogy is that "tests can't do the thinking for you". In that sense, a strict TDD workflow where you think only about the very next test might be undesirable. In case you didn't read it, this article explains it much better: http://patrick.lioi.net/2011/11/23/guard-rail-programming/

Sebastian

Brian Marick

unread,
Mar 27, 2015, 8:31:55 PM3/27/15
to clo...@googlegroups.com
Sebastian Bensusan wrote:
> What is TDD culture in Clojure like?

There are many ways to design a program, just as there are many ways to
write a textbook. In both cases, the right way depends on the subject
matter, but also on the personality and habits of mind of the writer(s).

This is not as well understood in the Clojure community as in other
language communities. Which is pretty typical of communities with
brilliant, charismatic, and opinionated leaders.

TDD, at least in the full Beck / London School style, is not popular.
But as long as you don't mind a little scorn ("guardrails"), there's
plenty of tools and helpful people to support you.
Reply all
Reply to author
Forward
0 new messages