A Conjecture About Good Design
I’ve been doing some radically different design after creating Dire a couple of months ago. My stance on local exception handling departs from what almost anyone else is doing right now - and there’s been some interesting repercussions because of it. The style of design that I’ve been pushing is one of airtight separation of concerns. Clojure’s runtime capabilities have...
Beautiful Separation of Concerns
I was going to write a nice narrative about how I wrote some beautiful code, but I’m just going to show it to you. I’d hate for my message to get drowned out in some boring text. You might recall that I wrote Dire a few months ago. I’m going to show you how to separate logging, preconditions, postconditions, and exception handling in an extremely elegant way. These concerns stay out of your...
try/catch complects: We can do so much better
Picture this. You’ve just finished writing a nice, clean function that clearly solves a single problem. It’s beautiful. It’s isolated. You’re happy. You poke around at it for a while and realize some viable inputs make it explode. Part of you wants good error handling to keep the end user sane, but another part of you instinctively doesn’t want to wrap that beautiful...
Designing with Topics in Clojure
Designing systems that obey the Open/Closed principle is tough. Here’s a nugget of wisdom about using topics to create a system that’s more fluid in terms of extensibility. I’ll demonstrate in Clojure. A topic is a type of message queue where all subscribers consume every message. An example of this in the small is Clojure’s juxt function. What happens when your functions...