Wednesday 19 September 2012

Autocomplete & API Design

Autocomplete Rocks

As an avid Eclipse user, I love auto-complete.  It feels like it's a big, easily overlooked boost to how I program.  Not because it saves a few keystrokes here and there, but because it provides such a boon to explorability of the APIs that I use.  Essentially, I'm querying my programming environment to see what my options are.

Seeing a list of IntelliJ's top 20 auto-complete features, there are some really neat ones - chain completion is particularly cool.  IntelliJ will inspect in-scope variables several levels deep, so it's able to suggest methods of in-scope objects that I hadn't even considered.

Basically, this is a specific, but handy, limited method of querying my codebase/libraries.  I can envision more complicates ones, such as a completion that would help me with that perennial Java I/O plumbing problem of how I get from a FooWriter to a StringInputStream.  Could an IDE make a few suggestions?

Auto what?

I'm also a frequent user of Apache Tapestry, and one of the things that occasionally confounds me about it is that whenever I get rusty with a particular component, I need to look at the documentation to see what I can do with it.

Not docs accessed through my IDE, but actually busting out a web browser, and navigating through some documents meant for humans to read.  Actual essays!

This is because, in Tapestry, you write event handlers by giving an ordinary method a special name:

public void onSelectedFromMyWidget() { ... }

Tapestry uses reflection to make the association between the this method, and the "selected" event thrown by the component with the name 'MyWidget'.

But here the IDE knows nothing about the meaningful names.  There's no object to inspect, no interface that defines all the callback methods.  If I forget that the event type is 'selected' for LinkSubmit components but 'action' for ActionLink components, I have to go to the documentation.  If I don't realize I've misremembered, my event handler simply never gets passed any events.

I recently learned that HLS codes in Emacs, I wonder if this is related!

Sunday 16 September 2012

Bothered About Dungeons & Dragons

The height of the anti-D&D movement of the eighties was a painful time for me; it put several of my friendships on hiatus, and effectively end my close relationship with my best friend of the time.

At the time, I never heard of BADD - this anti D&D sentiment was a vague thing, seemingly fueled by parents' worries and a story about a young D&D fan who killed two young girls in nearby Orangeville. It was on the horizon - mixed up with religious ignorance south of the border.

After a dry spell of a few months, in the company of other friends, I found my way back into gaming - through the Fighting Fantasy RPG (of all things) and back into AD&D with a new group of enthusiasts and new friendships. An unpleasant chapter ended.

15 years later I stumble on this Wikipedia article about Patricia Pulling, the founder of BADD, and the whole thing acquires a much more human face; it's a tragic story, really. Fervently believing that the suicide death of her son was a result of D&D, she sued his school's principal and started her one-woman crusade.

The article goes on to say that although she and BADD gained a fair bit of media coverage through conservative and christian media, all of the lawsuits she initiated or later consulted for failed. Her own book discredited her through factual and mathematical errors, and eventually no less than the CDC concluded there was no link between fantasy gaming and suicide.

I find it very moving to look at this as the story of a mother who can't accept the loss of her son, and what a load of wasted effort and pain she stirred up for others in the process.

"BADD effectively ceased to exist", it concludes, "when Pulling died of cancer in 1997. By this time, BADD had been reduced to Pulling as its sole member." Sad stuff.