Home > Uncategorized > A lament

A lament

When I decided to publish the first Code Dump, the thought process went something like this: “How do I have more content on my blog with a minimum of effort? Use something I’m writing anyways!” Thus, whatever code I wrote would make it up here, with a little didactic prefacing to give it a bit of context and make it of interest to non-coders.

The problem with this is that the code I put up was, interestingly enough, rather like my blog posts: more about the high level meanings than technical excellence. This is why, for example, my posts go up with typos on occasion: it’s not that I don’t proofread them, it’s that I am focusing so hard on getting my ideas across that even egregious typos (“wan’t” for “want”) flow under the bridge.

In a similar vein, my writing of Quicksort in Java was about clarity and readability rather than pure performance. This is not an efficient implementation, even though it was trying to teach a lesson about efficiency. But I knew that getting the point across was the most important thing, so I didn’t worry about using a Linked List instead of an Array, or so forth.

But these things that I knew wouldn’t matter to the readers of my blog mattered rather a lot to the, err, visitors I received from D-Zone, a sort of Digg social-networking news site, but aimed at coders. One of their members decided to submit the Java post for consideration by their readers, unsurprisingly resulting in the largest spike of traffic I’ve gotten yet.

At first, I was excited: finally reaching a bit wider audience. But as I read the comments, I found that they were almost entirely composed of people who misunderstood affairs in one of two ways. Some misunderstood my words and were attempting to correct some straw man problem. For example, one commenter criticized my invention of the term “variably stable” which I used to indicate the fact that Quicksort is not, by definition, stable or unstable.

Stable doesn’t mean “when I’m done, it’s perfectly sorted”. It means that for sorting lists with duplicate keys, the elements which share keys remain in their original order (relative to each other). In other words, you don’t swap two elements unless you have to.

Quicksort is never stable. (The wiki article says “in efficient implementations” – this means that you can make quicksort stable, but then it won’t be quick!)

Take the final paragraph: it’s contradictory. Quicksort is the name of the algorithm, and it’s still “quicksort” even if it’s slow. Clearly the entire point of my discussion of stability was missed.

But the part that takes the entire cake shop for me is the commenter who stuck his head in and fired off the following:

You most certainly must learn to take critics. They took time to analyze your code and comment on it, and you can’t even appreciate that?
Haven’t you benefited from them?

Despite my civil response to critics and conceding they were right in many cases, this guy somehow read some alternate blog post that involved me chewing out people for helping me. Or maybe he had an axe to grind? I have no idea.

The second type of misunderstanding is a bit more subtle and I don’t particularly blame. These people misunderstood my handwaving over low-level efficiency (data structures and so forth) and felt compelled to critique this particular aspect of the program. Despite this being immaterial to the lesson I was trying to teach, they trotted out Vectors versus LinkedLists versus Arrays in a discussion that I actually appreciated, were it not so uncalled for.

And then there were those who, as near as I can tell, didn’t even read my code:

FYI, your sort doesn’t actually work, e.g.

int[] arr2 = {2, 1};
quicksort(arr2);
System.out.printf(Arrays.toString(arr2)); // [2, 1]

The quicksort function returns the sorted list, which is why it’s declared as public static int[] quicksort(int[] inlist). But clearly, actually reading the code instead of just copying it into Eclipse and running it would be too much work. Instead of launching a pertinent criticism, this man just showed how little he actually cared about learning what I had to say. I can only fathom that, since he already knew how he would write a Quicksort, if he treated my code likewise, it would work. Clearly, it didn’t work, but for a reason that apparently escaped him.

Oh, and then there were the jokers that commented to show how they had written their version of Quicksort, which was an improvement on mine in this or that way. There was even one guy who linked to his implementation in Visual Basic. Why he believed I would unable to find such a thing, even if I were interested, is beyond me.

These days, I get an odd clickthrough here and there from DZone, but the Java post mostly just gets a few searches bringing people in from Google. I would like to think that these are the people that might benefit from what I have to say: people who come looking to learn instead of to deride. These are the people I would like to have as readers.

There was a time that such a huge spike in traffic would (and did) make my heart race. But these days, I’m content to know that my words are read by people who are literate (you would think that would be a tautology) and, generally, understand my message once it’s laid bare.

So, thank you. In so many cases in life, quality over quantity is the ruling axiom, and I certainly think that it has proven true in the case of blog readers.

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: