Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

The naming convention for a term like doSomething is camel case.

What would the naming convention of do-something be called?

share|improve this question

closed as primarily opinion-based by MichaelT, jwenting, david.pfx, Bart van Ingen Schenau, Dynamic Jun 16 '14 at 18:47

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

like-this-casing is very common in LISP/Scheme variants. –  hammar Aug 29 '11 at 17:30
It's the only naming convention that doesn't require a chorded keystroke, which makes my hands happy. You can't get away with it in most languages (LISPs being the notable exception), but I always use it as my file naming convention. –  Mud Aug 29 '11 at 21:44
I heard it's called kebab-case; also see this question. Rats, my "trivial" answer was converted to a comment :( –  aditsu May 14 '13 at 7:14
It's not "casing" at all. It's simply hyphenated. –  kevin cline Aug 6 '13 at 16:16
This question appears to be off-topic because it is about what name to give a thing. [And it's a duplicate on SO.] –  david.pfx Jun 16 '14 at 14:44

6 Answers 6

up vote 16 down vote accepted

Delimiter-Separated which could also use the underscore (Delimiter_Separated).

...A common recommendation is "Use meaningful identifiers." A single word may not be as meaningful, or specific, as multiple words. Consequently, some naming conventions specify rules for the treatment of "compound" identifiers containing more than one word.

As most programming languages do not allow whitespace in identifiers, a method of delimiting each word is needed (to make it easier for subsequent readers to interpret which characters belong to which word).

Delimiter-separated words

One approach is to delimit separate words with a nonalphanumeric character. The two characters commonly used for this purpose are the hyphen ("-") and the underscore ("_"); e.g., the two-word name "two words" would be represented as "two-words" or "two_words". The hyphen is used by nearly all programmers writing COBOL, Forth, and Lisp; it is also common for selector names in Cascading Style Sheets. Most other languages (e.g., languages in the C and Pascal families) reserve the hyphen for use as the subtraction infix operator, so it is not available for use in identifiers and underscores are therefore used instead...

share|improve this answer
Yeah, but this is too generic. Has anyone ever referred to camel case as "letter-case separated"? Plus, if anyone starts to learn Lisp because of my answer, we all win. –  Keith Layne Aug 29 '11 at 17:49
Sometimes called kebab-case, but hyphen-separated is also fine. What is important that libraries (like underscore.string actually know all these apart (camelCase, PascalCase, snake_case, kebab-case), albeit sometimes with different names, and allow you to use them as a fact of being. –  herby Apr 6 at 18:32

There isn't really a specific standard name for this case convention, and there is disagreement over what it should be called.

Lisp has used this convention for decades as described in this Wikipedia entry. For that reason, Keith Layne's answer of lisp-case is reasonable, though it's an original coining.

And according to this Wikipedia entry, it may also be called spinal-case or kebab-case (and the upper case version called Train-Case). All of these forms have also been contested as original coinings.

So there isn't a single widely-accepted name for this case convention analogous to snake_case or camelCase, which are widely-accepted.

share|improve this answer
+1 For a reference (even if it is Wikipedia. Shows that at least one other person uses these terms) –  KChaloux Aug 6 '13 at 16:47

I like "caravan case", because it looks like tokens chained together in a caravan. You can even picture a caravan of camels if you like.

share|improve this answer
Is this something you just now made up, or have you actually seen or heard someone use this term? –  Jay Elston Sep 2 '11 at 5:12
I made it up just now. I don't think I've ever seen it used anywhere. –  boshvark Sep 4 '11 at 18:39

Dasherization, usually used for URLs or other human readable cases.

share|improve this answer

I call it lisp-case for lack of a better term, and for a lack of seeing it used much (if ever) in other language families.

share|improve this answer
Here is a reference for you. –  Scott Whitlock Aug 29 '11 at 17:31
For all the haters out there...Lisp is older than the alphabet. Lower case had not been invented yet. As such case did not matter and therefore all your fancy naming conventions were useless, as everything got squashed to all caps. The dashes (which a Lisp interpreter would never confuse with application of minus) were the best way to make functions, etc. readable. –  Keith Layne Aug 29 '11 at 18:05
They are not haters, just that a few of us (lucky ones?) have been around longer than .NET and Java 1.6. History is not a fav topic in Comp Sci courses. –  mattnz Aug 29 '11 at 20:58
@matt True, but Scheme and Lisp should still be, at least in some places. My first ever CS course was taught in Scheme and it blew my mind and changed my major. I wonder about the state of today's CS education...used to be everyone used SICP. –  Keith Layne Aug 29 '11 at 21:24
While not technically an actual language - it's one of the common conventions that CSS designers use for naming element ids and classes. Also, HTTP header names use hyphen separators. So, true that Lisp likely did it first - but it's not a convention unique to Lisp. –  HorusKol Aug 30 '11 at 2:58

The only time I see naming like that is for SEO purposes, so maybe SEO-case? In any event, it's not a good naming convention to use.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.