In a recent blog post Herb Sutter improves some code which originally appeared in an online C++ magazine.
Here’s an example I saw again yesterday in a recent peer-reviewed online magazine article showing how to write some C++ code to solve a particular problem. There’s nothing wrong with the code I’m going to show; but it tries to use a technique to “save typing” while accomplishing the opposite because of being unaware of a clever little C++ feature.
I’ll rearrange the particular code I saw to disguise the example (lots of people do this, and it would be unfair to target one person).
I don’t want to discuss the technical content of Sutter’s post (which is as insightful as ever). It’s the surrounding context which interests me.
A peer-reviewed magazine
The magazine he mentions is peer-reviewed. Is Sutter claiming superiority over the peer-reviewers? I don’t think so. I suspect the magazine he refers to is The C++ Source, where the peer-review team reads like a C++ who’s who.
Were the reviewers lax on this occasion? I doubt it. I’ve been through The C++ Source review process myself, a journey which has ended in both acceptance and rejection, and can confirm the reviewers are thorough and stringent.
Or was it just a point on which the reviewers agreed to differ? Could be. But I’d say Sutter’s code improves the original substantially, and find it hard to believe the author wouldn’t make the suggested changes if offered them — unless he or she was paid by the templated parameter, that is.
The mystery is compounded when you see that Sutter himself is on The C++ Source review team. Well, I guess he must be a recent addition, otherwise he’d surely have offered his correction before the article was published. Still, you do see his name right up there on the magazine’s home-page.
Writing to learn
I think Sutter is mistaken to disguise the article and its author on the grounds of fairness. I’m not suggesting authors are thick-skinned or deserve rough treatment, but I think anyone who writes technical material learns about that material at the same time – yes, really, that’s one of the main benefits of writing. And however expert the reviewers, that learning process doesn’t stop once the article is published. The peerless Donald Knuth still writes out hexadecimal dollar cheques to anyone who finds an error in his work.
It would be more helpful to both the author and readers of the original article if Sutter had offered his suggestions directly as a comment on the article’s discussion forum — linking to his own website if necessary. Alternatively, he could have contacted the author privately and the article could have been revised. Web publishing makes this easy.
Maybe I’m reading too much into a blog post! As I’ve said before, I have enormous respect for Herb Sutter and all he’s done for C++.
Shell script slips
On a more personal note, I wrote an article for another peer-reviewed magazine, Overload, promoting shell scripting. As usual the reviewers did a great job, but since its publication a couple of readers’ comments have caused me to go back and revise it. It’s not about covering up my mistakes — as in the case described by Sutter, the original version worked well enough — it’s about making things as good as I can. Thanks to a couple of expert readers who took the trouble to offer direct feedback, I learned something, which now future readers can also benefit from.
As an even more personal aside, I want to apologise to anyone who’s had trouble either accessing this blog or commenting on it (apart from spammers, that is). I’m banging into resource limits on the shared server which hosts this site, and my fast CGI processes are being culled. I’m working out how to sort things out.
Unfunnily enough, I tried commenting directly on Herb Sutter’s blog. After signing in to Windows Live and entering my comment I got a “server error” message. I tried again, then tried using another session in a different web-browser. No luck. I then clicked the “Send a Message” button, entered my screen name, and was then presented with an email form to fill in. Above the form was a warning message:
You can’t send or reply to this person because of their communication preference settings.