Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the name for a mix of snake case and camel case?

I'm maintaining some legacy Java code, and I keep coming across a weird mix of camel case and snake case in the same blocks of code. Some names are entirely camel case, others are entirely snake case, and others are a weird mix (e.g. displayText_label_maxDiff or hasProperty_). I realize that these names aren't an accepted Java coding style, nor should they be. I'm just looking for a meaningful term to use in conversation.

Is there already an accepted name? If not, what would you propose? I was thinking of "cobble case," "roadkill case," or "strange case".

like image 813
mrog Avatar asked Jul 25 '17 21:07

mrog


1 Answers

At first glance it would appear to be some custom hybrid of camelCase and snake_case called Upper_Snake_Case or Camel_Snake_Case[1].

Closer inspection (as pointed out in the comments below) shows it is an even worse hybrid than that, caused by the inconsistency of not using an underscore _ before each capitalized letter.

At this point, the term lowerCamel_snakeCase would describe it (although lower_camelCase_embeddedUnderscore would be more precise[2]) but... there is no such thing.

So, if we're making things up anyway, the suggestion of a Mythological Hybrid Animal of awesome ugliness that combines a camel and a snake (and boar and ox or goat) seems fitting.

As boarCamel_oxOrGoat_snake_case would be a bit too verbose, ypotryll_case might be a better match[3].

Especially as the ypotryll only appears in all of European Heraldry once [4], as the badge of a man dubbed the "Butcher of England" who was known for being ugly and cruel. As he left no heir, the badge was never used again.

This, I feel, makes it a perfect match for this coding standard, both in form (combining a camel and a snake) and function (only encountered once and never to be seen again).

I hope this answers your question, an image of a ypotryll has been added for your viewing pleasure:

image source: https://mistholme.com/dictionary/ypotryll/


Footnotes

[1] As Upper_Snake_Case is often confused with SCREAMING_SNAKE_CASE or MACRO_CASE, using Camel_Snake_Case is the safer of the two to use.

[2] see http://wiki.c2.com/?CapitalizationRules

[3] To place credit where credit is due: the term ypotryll_case was coined by the author of this question in the comments below.

[4] It appears in Fenn's Book of Badges of c.1470 as the badge of John Tiptoft, 1st Earl of Worcester.

like image 166
Potherca Avatar answered Oct 17 '22 06:10

Potherca