Monthly Archives: May 2006

General

Work space

Hmmm, might have to finally go read some of this guy’s stuff, just because he’s a lot like me in this way: Malcom Gladwell/My Work Space

General

“Parasite Rex”

Parasite Rex (LOC, Amazon) by Carl Zimmer was a great read. I never really got a good introduction to parasites in my previous studies in biology, so I was greatly enlightened about their vast diversity and importance to life on earth. I was particularly struck by the new view of evolution that one gets when considering the intertwined life-cycles of parasites and their hosts.

Not surprisingly, it’s full of descriptions of processes that’ll make the worms under your skin crawl, so don’t bother if you’re squeamish about that. I have to admit that I (not very squeamish) felt a bit itchy when reading it, at times… All in good fun, though.

Here’s a parasite story on Zimmer’s blog that gives you a taste of some of the stories in the book.

General

Flow and Refactoring

Those being the names of two books I’m reading now. I like it when two things I’m reading, from different fields and for different purposes, turn out to have a nice connection.

It sorta struck me when Fowler mentioned “not once did I have to open the debugger, so the process actually flowed quite quickly”, that, yeah, there does seem to be a connection between flow and refactoring in a general sense.

With any complex project, there are multiple competing concerns. For example, in writing software, I want the functionality, but I also want a clean architecture, good performance, multi-platform capability, etc. With a document, I want clarity, completeness, cleverness, alliteration, etc. But due to limitations of brain-context-capacity, varying interest levels, and compounded complexity, it’s rarely possible to keep all these concerns going simultaneously. And swapping between them all the time can wreaks havoc with the potential for flow.

Given that, one can look at refactoring as a way to profitably resequence work. If I can’t fulfill all the concerns at the same time, I’ll just focus on slapping down something that works, forgetting for the moment all the other stuff. Then, one by one or two by two, I can go back and refactor in the other concerns, as time and interests permit. Beyond simply enabling me to get past the block of “I can’t do it all, so I shouldn’t start at all”, I can also match my work to my capacity and have some chance of getting a flow state going.

General

“The Eternal Value of Privacy”

I don’t usually link-blog, but this is a good piece:

Wired News: The Eternal Value of Privacy

General

Telling a story in code

I had a discussion with a client and a colleague yesterday about commenting code. I haven’t thought about this much lately because most of the code I’ve written in the last few years is, in practice, basically never touched by anyone else. I still prefer that type of work compartmentalization, but won’t be the way it goes in this project, so I’m led to ponder my commenting style.

In a couple words, my commenting style is ‘not much’. However, this is a defensible position :-).

Part of the defense is that when I hear the word ‘comment’, I think about, specifically, little bits interspersed through the code that explain what the lines around are doing. This is different than documentation, which are the bits prefacing each function that explain what the function is for, how to use it, and caveats. Documentation, I’m down with dat.

Speaking, though, of caveats, that is one place where I make sure to add comments. If I know that, say, a section of code makes sub-optimal assumptions about its environment, I mark that fact, and use a ‘TODO: ‘ string to make sure it stands out (today’s IDEs have an automatic feature to extract and display TODOs). Or if I do something that’s nasty, I give it a ‘HACK: ‘. (I do not, however, use ‘TOXIC: ‘, because I associate that with unpleasant memories from a previous work environment. However, you don’t care to know that.)

Beyond caveats, I add comments if I do something that’s so utterly cool and astounding that it’s worth a patent, even if I’m too lazy to patent it. However, this never occurs. If I can write the code, I’m sure you can read its intent. OK, not quite ‘never’… Sometime I do have pretty novel coding ideas.

The biggest problem with comments is that they can get out of sync, since they are not automatically semantically checked against the code they apply to. So I prefer to use features that _are_ semantically checked, in some sense, by the compiler or other tools in the chain. So variable names, for example: if a variable is named ‘isRequired’ and you write ‘if (isProhibited)’, which may be a reasonable thing in your mind at the time, the compiler will tell you there is no such variable and you’ll find your mistake. Other examples are modifiers like ‘const’ and ‘abstract’, assertions, etc. So if I can find a way to express my beliefs in those modes, I do that and skip the commenting.

Thinking about this has me in a sort of mood that I want to think of my code as telling a story. Of course, I’m telling a story to the computer, but the computer is both too dumb and too precise for that same story to make sense to a human. So if I keep my human audience’s cognition in mind in parallel with the compiler’s computation, I can use the syntactic richness of the language elements to tell the story simulataneously to both audiences. The computer doesn’t care about the difference between ‘InsufficientUserIntelligenceException’ and ‘N13B’, but a fellow coder will.

General

Smack!

Y’ever want to smack yourself until you cry?

Today I spent an hour and a half trying to figure out why a web browser control I placed in a dialog was refusing to show the page I navigated it to. I won’t go into the details of the symptoms and the things I tried to fix it, but it was weird, and I tried everything.

Turns out I had somehow placed two identical copies of the control on top of each other, and I was (successfully, probably) navigating the bottom one but not the top one. Geee, eeee, eeesh.

Of course, I can’t entirely blame myself, as it was the retarded IDE that caused me to plop down two copies of the control…

General

Depths

There are such depths in the collective human imagination that the most imaginative individuals, I’m convinced, can barely imagine them. Which is yet another of the things that keeps this world boundlessly interesting…