The Cusp of Helix

Intact Case [Details]

Intact Interconversion

Intact Case is the rules for natural interconversion of compound words which including an acronym in camelCase and snake_case. By adding one rule when converting, it enables mutual conversion while keeping the information of separate words and capitalization of an acronym.

camelCase ⇒ snake_case

#ProcedureActual Example
0original camelCasegetUTCDay
1tokenizeget + UTC + Day
+add a delimiter to after each acronymget + UTC_ + Day
2all words to lower caseget + utc_ + day
3concatenate with between delimiterget_utc__day

snake_case ⇒ camelCase

#ProcedureActual Example
0original snake_caseget_utc__day
1tokenize by delimiter [1]get + utc_ + day
2capitalize each word except firstget + Utc_ + Day
+If last letter of the word is a delimiter, remove the delimiter and to capitalize all letter of the word.get + UTC + Day
3concatenategeUTCDay

[1] When two delimiters are successive, proceed as follows.

  1. first one is as a part of previous token.
  2. second one is used as delimiter to tokenize.

When delimiter is at the end of the entire compound words, it means "added for the acronym".

In Case of Successive Acronym

XMLHttpRequest is a familiar class name in the Javascript of Ajax. HTTP is acronym, therefore to tokenize XMLHttpRequest should be as follows.

XML + HTTP + Request

But if to concatenated them simply as all uppercase XML and HTTP, can not seperate the compound words of XML and HTTP. The readability is not kept.

Examples for Unreadability

XML + HTTP + RequestXMLHttpRequest
parse + DBM + XMLparseDBMXML
TCP + IP + Socket + IDTCPIPSocketID

In Intact Case, if compound words has two or more successive acronyms, to use delimiter between them.

XML + HTTP + RequestXML_HTTPRequest
parse + DBM + XMLparseDBM_XML
TCP + IP + Socket + IDTCP_IPSocketID

This rule allows natural interconversion of camelCase and snake_case, which including some acronyms.

camelCase ⇒ snake_case

#ProcedureActual Example
0original camelCaseXML_HTTPRequest
1tokenizeXML + HTTP + Request
2add a delimiter to after each acronymXML_ + HTTP_ + Request
3all words to lower casexml_ + http_ + request
4concatenate with between delimiterxml__http__request

snake_case ⇒ camelCase

#ProcedureActual Example
0original snake_casexml__http__request
1tokenize by delimiterxml_ + http_ + request
2capitalize each word except firstxml_ + Http_ + Request
3if last letter of the word is a delimiter, remove the delimiter and to capitalize all letter of the word.XML + HTTP + Request
4concatenate (when two or more acronyms are successive, to use delimiter between them)XML_HTTPRequest