Archive for April, 2007

Density or Richness?

Wednesday, April 18th, 2007

A programmer colleague once observed, “You get more out of a line of code than anyone I know.” At various times this has felt like a criticism, at others, like a complement.

Note that my code was not obfuscated or deliberately opaque, it just had the fluff and the fat trimmed out. No dead code to be eliminated by the compiler. If the whole equation fit on one line, it was on one line. Etcetera.

When I first started writing technical articles, I found that my first drafts were too dense for easy readability by a factor of about two. Essentially, there was no redundancy. Every idea was there once, precisely expressed, each word selected for exactly the right meaning. It makes it just about impossible to contradict myself, but the reader has to understand each word exactly the same way I do. And there is no redundancy to help correct misunderstandings. So that density of writing is not desireable in explanatory or tutorial writing.

So a question is, where is it appropriate? Or perhaps, where is dense/rich expression used?

  • Math and Science: think how much verbiage has been written explaining e = mc2 or the wave equation in quantum mechanics.
  • Standards: here the lack of redundancy may be deliberate so the standard can’t contradict itself. There is often an unofficial section explaining the official section. Standards aren’t light reading, readers are expected to already be an expert, and a glossary in the back explaining terms is acceptable. There are standards for standards! ISO standards in English are required to use British spellings.
  • Poetry: same as math and science. Especially if it is not written in contemporary English. I read an analysis of Dante’s Inferno that devoted a page and a half to the first four lines of the original Italian, explaining the exact meaning of the words and their connotations.
  • Sacred Texts: same as science, math, and poetry combined. I recently read an analysis of the First Pillar of Islam, six pages to explain two short sentences of Arabic.

Admittedly my code is not as dense or rich as any of these, but what can I learn from them about writing rich code?

Maybe the solution is to write the code succinctly, with no wasted motion, no superflous lines, use good formatting and naming conventions. And then write a commentary on it. Supposedly comments and documentation do this, but in my experience, not enough effort is put into them. Too much commenting obscures the code. Not an improvement. Documentation is separate from the code and often the distance grows as the code evolves and the documentation doesn’t. Donald Knuth’s Literate Programming is a good, though partial solution.

I’m not sure what the solution is, but it isn’t dumbed down code.

Getting Things Done, TiddlyWikis, and Life Balance

Friday, April 6th, 2007

After a month of using d3, a TiddlyWiki extended to support Getting Things Done (GTD), I’ve decided that while an impressive hack, d3 is not enough to replace how I was managing my work load. What it missing is subprojects, parallel tasks, and ability to handle large TODO lists (hundreds of items). It is nice to have a Wiki to handle brainstorming, record research, etc. There are useful pieces here. Slicing the problem a little differently will work better. I can use the original TiddlyWiki or another small footprint Wiki to record the ideas, references, brainstorming, etc. And use Life Balance, a Palm Pilot application, to handle the scheduling aspects.
Part of the reason for trying out d3 was that my PDA, a 4 year old Handspring Visor, is on it’s last legs.  The current crop of PDAs running PalmOS (so I can continue using Life Balance) has one real drawback. AFAICT, they all use recharable batteries that are not user replaceable. So I have to carry a charger on long vacations instead of just dropping in a couple of ordinary AAAs if the batteries run down. And when the batteries die, I have to send it back to the factory and hope that they haven’t gone out of business.

I have been considering buying a Nokia N800 or a smart phone to replace my PDA. But I need some kind of TODO list manager for it. TiddlyWiki (and hopefully derivatives like d3) claims to run on the Nokia N800 UMPC/tablet. So my search for a PDA replacement continues. Perhaps OpenMoko, it uses standard user-replaceable batteries, is a smaller package than the N800, and is also an open platform. Writing my own Life Balance clone is doable but there are other things I’d rather be doing.