Talk: Contracts as Types

This talk about gradual typing in Clojure makes a case for combining dynamic languages with slowly-more-specific typing. (These days, I like TypeScript for this.) First delivery, Philly ETE ,April 2015: Also, PolyConf in Poznan, July 2015: PolyConf 15: Contracts as Types / Jessica Kerr – YouTube I wish I could find the version from Craft … Read moreTalk: Contracts as Types

Ultratestable Coding Style

Darn side-effecting programs. Programs that change things in the outside world are so darn useful, and such a pain to test.For every piece of code, there is another piece of code that answers the question, “How do I know that code works?” Sometimes that’s more work than the code itself — but there is hope. … Read moreUltratestable Coding Style

Fun with Optional Typing: cheap mocking

For unit tests, it’s handy to mock out side-effecting functions so they don’t slow down tests.[1] Clojure has an easy way to do this: use with-redefs to override function definitions, and then any code within the with-redefs block uses those definitions instead. To verify the input of the side-effecting function, I can override it with … Read moreFun with Optional Typing: cheap mocking

Fun with Optional Typing: narrowing errors

After moving from Scala to Clojure, I miss the types. Lately I’ve been playing with Prismatic Schema, a sort of optional typing mechanism for Clojure. It has some surprising benefits, even over Scala’s typing sometimes. I plan some posts about interesting ones of those, but first a more ordinary use of types: locating errors. Today … Read moreFun with Optional Typing: narrowing errors

Logs are like onions

Or, What underlying implementation is clojure.tools.logging using? Today I want to change the logging configuration of a Clojure program. Where is that configuration located? Changing the obvious resources/log4j.properties doesn’t seem to change the program’s behavior. The program uses clojure.tools.logging, but that’s a wrapper around four different underlying implementations. Each of those implementations has its own ideas … Read moreLogs are like onions

A victory for abstraction, re-use, and small libraries

The other day at Outpace, while breaking some coupling, Eli and I decided to retain some information from one run of our program to another. We need to bookmark how far we read in each input data table. How can we persist this small piece of data? Let’s put it in a file. Sure, that’ll … Read moreA victory for abstraction, re-use, and small libraries

Property tests don’t have to be generative

Now and then, a property test can be easier than an example test. Today, Tanya and I benefited. There’s this web service. It returns a whole tree of information, some of it useful and some of it is not. { “category”: “food”,  “children: [ { “category” : “fruit”,                … Read moreProperty tests don’t have to be generative

Talk: Concurrency Options on the JVM

or, “Everything You Never Wanted to Know About java.util.concurrent.ExecutorService But Needed To” from StrangeLoop, 18 Sep 2014 Abstract: A careful design lets you write a concurrent application without thinking about deadlock or synchronization. Getting to that design takes a lot of thinking. This session delivers the background you need to make good decisions about concurrency … Read moreTalk: Concurrency Options on the JVM