Thursday, June 6, 2013

Commands: noun, then verb

One of the little things that irk me: commands that start with a verb followed by a noun.

I fully understand why English-speaking people tend to put the verb first. In English, an imperative order is given verb first. "Insert this module! Delete this directory! Add this apt repository!" So English speaking programmers tend to use the same convention for program names.

Unfortunately, verb-first order breaks command searching via command completion. Suppose I want a module related command, but I can't remember the name. The part I'm most likely to remember is "mod". If it were "modins", "moddep", "modrm", etc., I could start typing "mod" and press <tab> and the various module-related commands would be listed. But if it's "insmod", "depmod", "rmmod", etc., I had better remember the particular verb used as well as the noun.

A related problem is that verbs tend to not be consistent. Why do we "ins" and "rm" modules but "add" and "del" users? The noun part is much more likely to be consistent. Once more, command completion comes to our rescue.

When I did Solaris admin, I was impressed that all their module commands started with "mod". I'm happy to note that people in the Linux world now mostly seem to get this as well. The early Linux module commands were "verb-noun" ordering, but the newer module commands are "noun-verb" -- "modprobe", "modinfo". Similarly, the early "user" commands were "adduser" and "deluser", but the modern equivalents are "useradd" and "userdel". Yay for progress!

[And now I have a reference for when I need to argue with someone on why they should rename their program! Yay me.]

2 comments: