Thursday, November 26, 2009

K ?

Whisper the terrible words type erasure to any moderately experienced Java programmer and you're likely to see:
  1. fear
  2. loathing
  3. soul-crushing sense of defeat
  4. all of the above
Now if you are a moderately experienced Java programmer, but you're thinking to yourself "what's type erasure ?" my advice is this:

Stop reading now !

Sometimes ignorance really is bliss.

My own rule of thumb, when confronted by the need to query the identity of K, or V, or T or any of their evil friends, in the innards of a class with generic type parameters, is to run away. Sadly, there are circumstances when that's just not an option. Although I deeply empathise with those who equate Java reflection with incest and folk dancing there are times when it's black magic or nothing. But where to find the magic ?

Enter Richard Gomes and his article: Using TypeTokens to retrieve generic parameters. This demonstrates the seemingly impossible feat of pulling erased rabbits out of Java's hat.

I'm off to try it now... "Nothing up my sleeve..."


Tuesday, November 17, 2009

PragProWriBlockMo

PragProWriMo has been even more challenging than I'd feared thanks to my sub-gnat concentration span and memory like a... you know, round thing with holes. While others have been trotting out chapter outlines, finding their voice and defining their readership, I've been shuffling along the beach of irrelevancy and gazing out at the ocean of unfinishedness.

It's amazing / pathetic / pathological (select all that apply) just how intimidating this simple daily writing exercise has become. The main problem has been the notion of a book hovering over the writing. No matter how many times I've told myself to treat the writing as a pump-priming exercise rather than an examination, I haven't been able to shake the anxiety of not "seeing the book" in my mind's eye.

But I will not surrender ! Well, that's not quite true because I did a few days ago, giving up on the whole thing as too hard. Now though, I'm putting the white flag back in the cupboard and making a new start. Rather than imagining the goal as a book I'm going to structure it as a set of short web tutorials.

I wonder if I can count this post ?

Sunday, November 1, 2009

PragProWriMo begins

November is here and this not-so-young-anymore geek's heart has turned to writing. I'm taking up the challenge of PragProWriMo by committing (forcing, tricking...) myself to write every day. The target is eighty pages by the end of the month.

As someone who has routinely taken years to write an eight page scientific paper (only four pages really if you subtract the tables, figures and compulsory, gratuitous citations of the publications of those who you suspect might review your paper) eighty pages seems an imposing target.

Ah well grasshopper, the longest journey etc. etc.

My chosen geek book working title is Biological Models in Java. That's likely to change as the writing progresses of course... I can already see it wandering towards Mathematical Recreations in Java, Ruby, Groovy, Clojure, R and that other language (you know, the one with the clicking sounds).