I often start out by writing code specific for a single project and then refactor it to make working code more generally useful. I am working on an applications book for the AllegroGraph RDF data store services. Since most people (probably) use Java clients with AllegroGraph, the first step is to wrap Franz's APIs with my own interfaces so for my own work (that is, beyond the scope of writing this book), I can write implementations for other back end RDF data stores as I need them.
I also plan on writing "thin" Scala, JRuby, and Clojure friendly interfaces to my Java library. For the purposes of the book, I'll use this library to support example client applications written in Java, JRuby, Scala, and Clojure. I have a lot of material already written with Lisp examples but I think that I am going to set that all aside for a future writing project (that I may, quite honestly, never get back to). I also decided to not support Python in my book: Franz has a good Python interface library and examples and in any case, I am not a Python developer.
So far, I have a fairly clear road map of what I need for this specific book project. Long term, after this book is done, I am aiming to also wrap other knowledge sources like OpenCyc, Freebase, etc. While it is tempting to view most knowledge sources as graph data (RDF), it seems like a poor idea to give up the inferencing available in OpenCyc, all the features of the Freebase MQL query language, etc.
Since I often find myself reusing my own small code examples to access multiple knowledge sources, it may be time soon to step back and decide what can be placed behind common interfaces.