views:

109

answers:

2

Hi,
I have been doing a number of projects in Delphi, which uses the case insensitive language Pascal, and I was wondering what the advantage of case sensitive languages is.
Jason argues that "Case insensitivity introduces much ambiguity". I don't agree. If you realize that the language is case insensitive you know that WHILE means the same thing as while, even if you never write the former. Same for variables and functions; camel casing is nice, but was the first letter also a capital or not? And what about functions whose name starts with an underscore? In case insensitive languages no problem: _fooBar will do just as nicely as _FooBar. So where's the ambiguity Jason refers to? Yes, you can write a variable in different ways, but the meaning is unambiguous! FooBar == foobar!

In the same thread Delnan says that Capitalization is the difference between "I had to help my uncle Jack off a horse.." and "I had to help my uncle jack off a horse..". Very clever :-). But rather a point against than pro case sensitivity: would you accept that your code goes haywire because of a single capitalization error? Again, in a case insensitive language, if Jack is a person, so is jack.

Question: is there anyone who uses this feature in case sensitive languages that you can define two different variables or functions just by different capitalization? Because that's the only advantage I can see in it. Sure, you'll say, I write the variable name with camel casing and the constant all uppercase. But IMO they're incompatible; userName as a variable makes sense, but USERNAME as a constant doesn't.

(I realize that many programmers use case sensitive languages, so I'm prepared for a unwelcome reception :-))

edit
The trigger for this question was Lynda.com's "ActionScript 3.0 in Flash CS3 Professional" training video, in which Todd Perkins spends half of his time emphasizing the capitalizations :-)

+4  A: 

Yes, I absolutely use this all the time in C#:

private readonly string name;
public string Name { get { return name; } }

I've tended to use case-sensitive languages, and haven't really seen downsides of them - aside from anything else, they force consistency of casing.

It's really a personal preference thing though, I think.

Jon Skeet
I've worked with case-sensitive languages all my career, and I sometimes wish C# wasn't! Oh well, that's never going to happen!
Mitch Wheat
More of a mindset thing than a preference thing I reckon. When I first came to C# from Delphi I was horrified by this coding style. Now I use it all the time and I'm fine with it. I'm fine with case-insensitive Delphi too.
MikeJ-UK
+3  A: 

I personally like neat and tidy code. If your language is not case sensitive it has the potential to be come messy if everyone doesn't stick to the rules.

private String myName = "Shawn";

  if(myname.equals("Shawn"){
    MYNAME = myname + "Vader";
  }

  System.out.println("His name is " + MyName);

Even in a case sensitive language we spend a lot of time making sure that everything is consistent, like running analysis tools to enforce naming conventions of fields and formatting rules and final method parameters.

So for me it's a question of conformity.

Shawn