Fork me on GitHub
#clojuredesign-podcast
<
2024-02-01
>
neumann19:02:51

Have you ever spent more time scaffolding a test than writing it? Must I/O-laden code be awful to test? Can simple logic be tested simply? In our latest episode, we need to test our logic, but the I/O is getting in the way. https://clojuredesign.club/episode/109-extractify/

neumann19:02:03

What's the thorniest unit test you've had to write?

lukasz19:02:33

I'm working on a legacy codebase where all stateful resources (connection pools etc) are stashed in dynamic vars, the run-in-test-context macro is 15 lines long, and that's just to make testing possible

1
neumann19:02:31

When I hear "dynamic vars", I immediately think "race conditions". 😆

lukasz19:02:32

I haven't found any, the code is pretty ok, it's just not written in what I'd call idiomatic and with explicit mutable state management. But you never know!

neumann19:02:48

So much of my Clojure learning experience has been learning different patterns and techniques than the ones I used in OO. I started by trying to "port" my OO thinking into Clojure, and now I write code that I can't imagine "porting" over to OO! 😂

lukasz19:02:37

oh, my first attempts at writing Clojure was to emulate how Ruby/Rails worked - db connections appearing out of thin air, auto loading and all of that - it took a while to unwind :D

😄 2