I'll break this down:
Why do programmers have annoyingly mixed case function names?
Firstly, because you can't have a function name with space
s. You need to either substitute underscores for spaces, or remove them entirely. Suppose you have a function
that converts data of Format A to data of Format B. You can do this a few ways:
- Convert_Format_A_To_Format_B(A, B);
- convert_format_a_to_format_b(A, B);
- convertformatdogatoformatb(A, B);
- ConvertFormatAToFormatB(A, B);
The first two may seem slightly more readable, but they aren't used much because
underscores are a major pain
. There's also an issue of where you put the underscores... is 'FormatA' one word? Standardizing things means you don't need to check your header
s as often. The first two are also longer, and the more visual space you can conserve
, the better.
The third one is, obviously, much harder to read
. Mixed Case may be 'annoy
ing', but it's much better than having to decipher
all lower or upper case
. The function name could be read as "Convert for Mat at of or Mat B". Which doesn't make any sense. And you probably didn't even notice that I threw the word 'dog
' in there.
The fourth function, while slightly less readable than the first two, is much easier to type and has no standardization issues.
Why do programmers have long function names?
Sure, you COULD call the function 'CFA2FB'.. but that makes no sense. Even if you just simplify it to 'CvtFmtA2FmtB', there's a question of what kind of abbreviation
standard you're using. Did you abbreviate 'Convert' to 'Cvt'? Or 'Cnvt'? Maybe 'Conv'? And someone else reading your code might thing 'Cvt' stood for 'Covet
'. THAT also doesn't make any sense, but not everyone's as bright
as you are. Grin.
If the function is only used a few times in your program, you're better off leaving it unabbreviated so you don't have to check your headers every time you need to call it. If you call it something like CFA2FB, you'd need to add a comment along the lines of '// Convert the data (in format A) to format B.' anyway, so you wouldn't save time. (You do comment your code
If the function is called frequently, however, you're unlikely to see a fully descriptive function name, simply because the sheer number
of times you have to type the thing mounts up. However, because it's used frequently, you shouldn't need to check headers, so you can call it whatever you want