Pondering 42 in Finite States

Yet another blog, by yet another person.

Random stuff about Python, Java, Scala, and other random stuff.

2008-06-22

On Case Sensitivity

If you were asked whether you preferred case-sensitive or non-case-sensitive behaviour, what would be your reply?

In a programming language, I would prefer case-sensitive behavior. It makes the code a lot easier to read.

I had the misfortune of reading some VBScript code, and one of the miseries (apart from the horrible Hungarian notation) was having to identify the same variables that were in different case combinations in different places. Some instances were all upper case (STRINPUTNAME), others were all lower case (strinputname), yet others followed Microsoft-style variable naming convention (StrInputName), and in some cases, they were even managed to use Java-style variable names (strInputName).

From the above statement, it is clear that I prefer Java and C#'s behaviour over VBScript's behaviour, but I am getting greedy and want even more. I want a behaviour which forbids names that are different only in case.

.Net seems to forbid names that are different only in case (as in Java, C, pretty much everything out there), probably to inter-operate with case-insensitive languages. However, the advantages of this does not seem to be available in C#. C# does not seem to enforce this (probably for the sake of tradition or C++ interoperability or whatever).

In the Java world, using names that differ only in case is frowned upon, so why not just prohibit it? I suppose it is too late now.

I do not like case sensitive behaviour in other cases. For example, in variables exposed to web page templates. This is because I have to hand them off to people who do not code in typical programming languages, where case-sensitiveness is so handy. In these cases, case sensitiveness becomes a hurdle.

I keep wishing that JSP EL variables were case-insensitive. Can't change that now.

I can also say the same for file-system object names. Here, Windows seems to have got it right.

This page is powered by Blogger. Isn't yours?

Feeds

Subscribe to
Posts [Atom]

Bookmarks

Previous Posts

Archives

   2004-05     2004-06     2004-11     2005-04     2005-05     2005-06     2005-10     2006-10     2007-02     2007-03     2007-04     2007-12     2008-03     2008-06     2008-07     2008-09     2008-10     2009-07     2010-07 
© 2004-2009 FiniteState42i (yahoo.com ID: finitestate42i)