RSS Amplifier

Thomas Mansencal · Feb 4, 2014

The CamelCase of Mister __Underscore!

0
Sign in to vote or save

Thomas Mansencal · Thomas Mansencal

This one is for the nerds!

I have been a big UpperCamelCase or lowerCamelCase user since I have started writing code:

def myVeryCoolFunctionName:
 pass

In our demoscene group we were using CamelCase, Maya Mel or commands are all in lowerCamelCase, all studios I have worked in were using a variant of CamelCase. I always preferred that naming convention to the Underscore one:

def my_very_cool_function_name:
 pass

It's maybe because my brain has the habit of processing it but I find easier to read CamelCase than Underscore naming convention, there is no visual break, just a continuous flow of words dancing front of me!

Now after so many years programming I just came across a very annoying issue, it's actually not the first time but usually I lived with it. Let's say that you have a definition that converts some data to sRGB color space, you would write it this way in lowerCamelCase:

def convertDataToSrgb:
 pass

If you want to respect the naming convention you have to change the case of sRGB to Srgb. In those cases I often write the function name like that:

def convertDataTosRGB:
 pass

Or:

def convertDataToSRGB:
 pass

Neither version is sexy, although it's understandable without much problems. Now these days I'm working on a color science Python API and I faced some situations where using CamelCase can be even more confusing than the sRGB example above and even change the meaning of the definition.
I'm doing some basic colorspaces conversion like CIE XYZ to CIE xyY, etc... The problem is that in color science little y is very different from big Y ( http://dougkerr.net/Pumpkin/articles/CIE_XYZ.pdf ).

So when you write something like that:

def xyzToXyy:
 pass

Which Y are you talking about? A person with knowledge in the domain would guess that you want to convert from CIE XYZ to CIE xyY colorspace.

You could write it this way to help but it's not visually elegant:

def XYZToxyY:
 pass

Underscore naming convention really shine here and makes this beautifully unambiguous and clear:

def XYZ_to_xyY:
 pass

If you have any thoughts on this, I would be keen on hearing them of course!

Read the original on thomasmansencal.substack.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.