1. Original Entry + Comments2. Write a Comment3. Preview Comment
New comments for this entry are disabled.


October 14, 2011  |  Dennis Ritchie, technical writer  |  6336 hit(s)

Dennis Ritchie, the co-inventor of Unix and of the C programming language, died this week. There are many, many eloquent tributes to Dr. Ritchie, who was both a seminal figure in computer science and, it seems, a nice guy.

Among his accomplishments, as people note, was thtat Ritchie was an excellent writer. Here's the New York Times:
“There was a remarkable precision to his writing,” Mr. Kernighan said, “no extra words, elegant and spare, much like his code.”
Of course, this is most evident in what might be the most famous programming book, namely The C Programming Language, which Ritchie wrote with Brian Kernighan:


The book is widely regarded as one of the best programming tutorials ever written: a complete introduction to C in 228 pages (1st edition). K&R, as it's known, is a much-beloved book, having a place in the hearts of programmers that Strunk & White does in the hearts of writers.[1] (It helps, of course, that the C language itself is sparse, but this simply underscores that Ritchie understood economy of style in more than one field.) A page on the Bell Labs siteBrian Kernighan's site shows the many translations of K&R into languages other than English.

The style of coding that Kernighan and Ritchie used in their book became a model for how to write C programs. Likewise the writing style in K&R had wide influence on how programming books came to be written, and many a book has strived to be "the K&R of ______" for a particular programming language.

K&R is also responsible for what's surely the best-known example in programming circles, namely "Hello, World". As represented in K&R, it looks like this:
main()
{
printf("hello, world\n");
}
The term "Hello, World" has entered the lexicon of programming to mean the first example for any programming language. Wikipedia includes an entry that shows "Hello, World" examples for 59 programming languages, from ActionScript to Visual Basic.[2]

In fact, "hello world" has come to mean the first or simplest example for how to start learning most anything. Some examples:
Sometimes you just have to marvel at people's achievements. Dennis Ritchie helped to write the foundational programming language of the modern era, helped launch the operating system that's the backbone of the Internet, and oh, yeah, helped define modern documentation style. How cool is that?


[1] Like Strunk & White, K&R is probably more honored in people's memory than in day-to-day use.

[2] When I went to the user group meeting the other day, Doug Seven showed how to create a Metro-style app. He began by saying “The ‘Hello, World’ app of our era is an RSS reader” and then showed how to do this. I was amused by his opening remark, so I tweeted it. Right away I got a reply: “RSS is soo 2009, it's the twitter reader app now.” Haha, true.




Kent Sharkey   14 Oct 11 - 11:30 AM

K&R is also significant for showing the world the correct way to use braces as well. ;)

 
mike   14 Oct 11 - 11:46 AM

Ah, Kent, I see you're One Of Those People. :-)

Actually, I believe the opening-brace-on-its-own-line paradigm (creed, dogma) was just enshrined in our (enforced) code conventions.

For JavaScript, too, although after it's all been minified, who cares? :-)


 
Alon   17 Oct 11 - 1:21 AM

Unlike Strunk and White, Ritchie and Kernighan really knew what they were doing.

I still prefer GNU indentation, though, even if it's hard to configure in vi.


 
mike   17 Oct 11 - 8:01 AM

@Alon -- Yes, I did try to indicate that the relationship between S&W and K&R was primarily in people's feelings toward the book, not in any inherent qualities of the books themselves. (I am well aware of Pullum's screeds about S&W: prime example.) When you ask writers and editors about books about writing, S&W always is always in the top 5, but I think this is among people who already know writing and have warm feelings about, say, a college composition class or something, and not based on day-to-day use of the book to learn writing. I think K&R has a similar place among those who have learned (as opposed to those who are learning) C, and people might not accurately remember how much they were obliged to learn after they used K&R to get started. Dunno, I might be wrong about that latter, but I'll certainly stand by my assertions about S&W's place among writers.

 
Karla   17 Oct 11 - 3:25 PM

?"is a much-beloved book, having a place in the hearts of programmers that Strunk & White does in the hearts of writers" Are you kidding me? If I advocated book burning, Strunk & White would be one of my first choices. Or maybe Mike Pope doesn't like his book. (Strunk & White fills newbie writers heads with a lot of incorrect "rules" that aren't rules.)

 
mike   17 Oct 11 - 3:42 PM

No, I don't like S&W. But it always appears at the top of lists of recommended books for writers. (Not by me.) Again, my comment is not about the content of S&W (vs K&R), it's about the place that that book has in such lists. Look at the reviews on Amazon, for example; people love Strunk & White. 309 reviews, average rating 4-1/2 stars. Apparently Stephen King recommends it. Now look the reviews for K&R ... 305 reviews, average rating 4-1/2 stars.

No one has to convince me that S&W has many flaws, is often self-contradictory, and contains a lot of vapid advice. (As Ben Zimmer once said, "[Strunk and White's] larger rules are something you could never disagree with: "Omit needless words." If you knew which words were needless, you would not need the advice.") I have in the past challenged people to tell me which specific elements of style they've learned from this book and regularly apply today. No takers so far.

That said, S&W has some things in common with K&R. For one thing, it's short. One of the things that people really about K&R is that it's not a 1000-page behemoth. S&W aims (success arguable) to emphasize concision and clarity. (Probably a more radical recommendation when Strunk was teaching English in the late 19th century.) It is comprehensible to novices. The advice it gives that is sensible -- and not all of it is bad -- has stood the test of time. The book itself has simply endured.

As I say, I'm not defending S&W. All I'm saying is that, for better or worse, S&W is a foundational text for learning to write, the way K&R is for learning C. I'm not saying this is a good thing, just that that's the way it is.


 
Karla   17 Oct 11 - 4:05 PM

Understood, thanks for clarifying. ;-)

 
Kent Sharkey   18 Oct 11 - 8:49 AM

Who knew S&W was even more controversial than "where do you put your braces?" ;)

Maybe you need a new post: "Apostrophes: do we really need them?" Or something to really get people riled up: "Apostrophe's: do we really need them?" :D


 
mike   18 Oct 11 - 9:07 AM

Kent, the editorial equivalent of the "braces -- same line or next line?" controversy is, I believe, serial commas. :-) Or failing that, the "one space or two after periods?" discussion.