Notes On Programming In C By Rob Pike

Really interesting article from Rob Pike, a member of the Unix team and Plan 9. Here’s a short excerpt from the article:

Kernighan and Plauger’s The Elements of Programming Style was an important and rightly influential book. But sometimes I feel its concise rules were taken as a cookbook approach to good style instead of the succinct expression of a philosophy they were meant to be. If the book claims that variable names should be chosen meaningfully, doesn’t it then follow that variables whose names are small essays on their use are even better? Isn’t MaximumValueUntilOverflow a better name than maxval? I don’t think so.

What follows is a set of short essays that collectively encourage a philosophy of clarity in programming rather than giving hard rules. I don’t expect you to agree with all of them, because they are opinion and opinions change with the times. But they’ve been accumulating in my head, if not on paper until now, for a long time, and are based on a lot of experience, so I hope they help you understand how to plan the details of a program. (I’ve yet to see a good essay on how to plan the whole thing, but then that’s partly what this course is about.) If you find them idiosyncratic, fine; if you disagree with them, fine; but if they make you think about why you disagree, that’s better. Under no circumstances should you program the way I say to because I say to; program the way you think expresses best what you’re trying to accomplish in the program. And do so consistently and ruthlessly.”

Rob Pike: Notes on Programming in C (

Written on December 9, 2011