In the course of my C programming (the pinnacle of which has been work on the Linux kernel), I’ve grown accustomed to the Linux kernel coding style.
It’s great. Now every bit of C I’ve written follows, more or less, this
standard. It feels clean and crisp. It addresses naming conventions (
loop_counter, for instance), but it doesn’t address a more subtle issue—the
naming of functions that perform an action.
There are two obvious sides to this issue: either verb-object (VO) or
object-verb (OV). With the verb as “set” and the object as “foo”, would the
corresponding C function be
Examining English, a subject-verb-object
language, it’s pretty clear that the preferred form would be
course, there are other languages that are principally SOV, but the vast
majority of C is written in English, so it is probably bound to follow
In other programming languages, there can be explicit conventions. Java’s
setter and getter methods are the first examples to come to mind. We would have
getFoo(). Of course, because Java is object-oriented, we
understand that there is a usually subject (i.e. the instantiated object) that
comes before it, so it is appropriate to retain the SVO form:
But there are examples where it would be clearer to use the object in question
first. The Linux kernel provides a
file, which specifies function prototypes for some atomic operations. All
function names begin with “atomic”:
Something similar happens, albeit with less consistency, with x86’s
It’s painfully clear that people establish conventions and maybe even flip-flop between one and the other. I personally can’t decide, and I still throw my hands up in resignation when it comes to naming things other than functions.