A Project Naming Recommendation

drbrain | Wed, 20 May 2009 23:08:02 GMT

Posted in ,

I’ve gone through many different styles of project names, but I think I’ve finally found a naming scheme I like.

In the past, I’ve used class names with uppercase letters, dashed names and underscored names, and I think the underscores are the best for projects I’m packaging in ruby.

Rails solidified the convention of mapping CamelCase class names to underscored file names (class IMAPProcesor is defined in imap_processor.rb). Using underscored gem names makes it easy for people to figure out what file to require (same as the project name) or what class name to look for in ri.

If I have a plugin gem or an extension I’ll tack on the sub-project’s name with a dash. If I wanted to add a new handler for imap_to_rss for Chase bank email, the gem would be named imap_to_rss-chase.

This makes it easy to find in gem list -p and it conveniently namespaces the extension. It also would look nice with gems from github which break up author and project with a dash (drbrain-imap_to_rss-chase, if I used github). As an added bonus, when double-clicking any underscored part OS X only highlights a part of the name making cut-and-paste a little more convenient for picking apart gem names.

Currently almost 95% of gem names start with lowercase letters, 6% contain uppercase letters anywhere in the name, a little over 20% use dashes, 16% use underscore. Sixteen use both underscores and dashes (my favorite name being what_does_this_error_mean-merb).

comments

Comments RSS FEED

I was hoping this post would have something to do with a certain search engine wrapper named after a part of the human anatomy.

Michael Nutt said about 5 hours later

There are two you know, which one? Sphincter or Texticle?

Eric Hodel said about 21 hours later

Comments are disabled