Sorry for the radio silence, but recently I've been focusing my writing time on the KSM Partners Blog. My writing there is still technical in nature, but it tends to be more heavily focused on the JVM. If you're interested, here are a few of what I consider to be the highlights.
In mid-2013, I started out writing about how to use Runnable to explictly enforce dynamic extent in Java. In a nutshell, this is a way to implement try...with...resources in versions of Java that don't have it built in to the language. I then used the dynamic extent technique to build a ThreadLocal that plays nicely with thread pools. This is useful because thread pools require an understanding of which thread you're running on, which thread pooling techniques can abstract away.
Later in the year, I focused more on Clojure, starting off with a quick bit on the relationship of lexical closures to Java inner classes. I also wrote about a particular kind of stack overflow exception that can happen with lazy sequences. Lazy sequences can nicely remove the need to use recursion while traversing their length, but each time two unrealized lazy sequences are combined, it adds to the recursive depth required to compute the first element. For me, this stack overflow was a difficult error to diagnose, because it seemed so counter-intuitive.
I'm also in the middle of a series of posts that relate the GoF command pattern to functional programming. The posts start off with Java, but will ultimately describe a Clojure implementation that compiles a stack based expression language into optimized Java bytecode. If you'd like to play with the code, it's on github
- Middle School Math, Reverse Polish Notation, and Software Design
- RPN Calc, Part 1 - A Simple Calculator in Java and the Command Pattern
- RPN Calc, Part 2 - Composite Commands
- RPN Calc, Part 3 - Undo
- RPN Calc, Part 4 - A Noun for State
- RPN Calc, Part 5 - Eliminating the Globals
- RPN Calc, Part 6 - Refactoring the REPL with an Iterator
- RPN Calc, Part 7 - Refactoring Loops with Reduce