Java News from Friday, June 16, 2006

IBM's developerWorks has published my latest article, Testing object serialization. Serialization is one of the easiest interfaces to a class to u8ninentionally break and surprisingly one of the least tested. In fact, it's possible to to have 100% code coverage while still having broken, unnoticed, and untested serialization. This article explores the basic techniques for testing that objects that implement Serializable can be serialized and remain compatible from release to release.

The Apache Jakarta Commons Project has released Commons Chain 1.1, an open source implementation of the Chain of Responsibility design pattern. According to the web page,

A popular technique for organizing the execution of complex processing flows is the "Chain of Responsibility" pattern, as described (among many other places) in the classic "Gang of Four" design patterns book. Although the fundamental API contracts required to implement this design patten are extremely simple, it is useful to have a base API that facilitates using the pattern, and (more importantly) encouraging composition of command implementations from multiple diverse sources.

Towards that end, the Chain API models a computation as a series of "commands" that can be combined into a "chain". The API for a command consists of a single method (execute()), which is passed a "context" parameter containing the dynamic state of the computation, and whose return value is a boolean that determines whether or not processing for the current chain has been completed (true), or whether processing should be delegated to the next command in the chain (false).

Version 1,1 adds two dispatch style commands, improves the LookupCommand, and fixes bugs. Commons Chain is published under the Apache 2.0 license.