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/
What's the thorniest unit test you've had to write?
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
When I hear "dynamic vars", I immediately think "race conditions". 😆
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!
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! 😂
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