vakkotaur: (computer)
[personal profile] vakkotaur


I've seen discussions, or rather arguments, about whether MixedCaseVariableNames are better or if underscore_linked_variable_names are better. I have dealt with both. From my Forth background, I rather prefer the MixedCaseVariableNames as one of the Forth tools I have results in printouts with underlines, which make underscores indistinguishable from spaces - this is a Bad Thing when trying to debug. Of course, in Forth I can use ~Variable-Names-With*Unusual-Characters-in-Them! if I am so inclined.

Now that my bias has been revealed, I'll address one of the notions of some of the underscore users. The idea is that say, this_is_a_test won't have the missing capital problem that ThisIsATest might if someone flubs and uses ThisIsaTest instead. This error could be found with a system that demands all variables be explicitly created. But not all systems are like that. Many are, or can be, quite lax and let the first instance of something substitute for an explicit declaration.

But the problem is not even that. The problem is that of case sensitivity. In an ideal system, case would be preserved, but not distinguished between. That is, if I make a variable named CustomerID the system editor won't go changing it on me to be customerid or CUSTOMERID but will leave it alone as CustomerID. But it will also accept CUSTOMERID and customerid and customerID and they will all point to the same information as CustomerID. Not that the programmer should go around not caring about case. Ideally each instance of the variable would look like all the other instances of the variable - but that's something the search-and-replace function of an editor can handle if need be.

"But that means you can't use each separately!" That's right. Which means I'd have to think up names that won't overlap in mental name-space and be confusing. It would require that I not obfuscate my code, at least not by abusing case.

Now, MiXedcAsevaARiabLeNAMe is something that does deserve to be editted out of any respectable program. Unlike MixedCaseVariableName, nothing is gained in readability by random capitalization. Rather, it just makes the programmer look like an idiot.

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

vakkotaur: Centaur holding bow - cartoon (Default)
Vakkotaur

March 2024

S M T W T F S
     12
3 456789
10111213141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 6 January 2026 14:03
Powered by Dreamwidth Studios