- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
At the risk of going off topic, I'm pretty indifferent about case-sensitivity in programming languages. But I really don't like it for file systems, and try to work around what I see as that dumb decision by turning on case-insensitive globbing and tab completion. That takes care of most issues.
Admin
Thanks for the synopsis sans sarcasm.
Admin
Then of course there's Java's Int vs int types, which sounds much more sensible than iNt and inTeGeR types if it were case insensitive.
Then it's much nicer to "grep" for things in code when case has a meaning. Example: if all classes start with upper case letter, it's easy to grep for classes starting with something without getting a billion variables and functions starting with same string.
Yet more reason is name space pollution. When cases are different, name spaces are bigger (twice as big per letter used in a name).
And finally, there's the fact that 99% of sloppy coders produce not only sloppy but crappy code, and only sloppy coders would like to use variable case for same identifiers. Crappy coders aren't worth listening to, and sloppy but non-crappy coders are such a minority that they can be safely ignored (proven by the fact that popular languages mostly are case-sensitive).
Admin
TRWTF is variables.
Admin
Admin
Admin
Also, some filenames have a nasty habit of finding their way into URLs, which -- like it or not -- ARE case sensitive, so even though index.html and Index.html might resolve to the same file on your system, the entire web is going to think you have two different pages on your site, and behave accordingly. This breaks a lot of stuff.
Admin
Admin
If people hadn't made the stupid decision back in the 60s to have a case-sensitive file system in the first place, there wouldn't have been a separate Makefile and MAKEFILE in the first place. ;-)
IMO the fault there lies entirely with the project and not the file system; it's not like case-insensitive file systems only recently became common or something.
(The only argument against it I find convincing are based off of internationalization arguments that don't apply if you just have ASCII. So I stand by my statement that the decision was originally stupid even if it's less stupid now.)
Like what? Considering that a not-insignificant percentage of the web runs on IIS, I'm surprised that it's not burning in flames.
Besides, having a case-insensitive file system doesn't mean that the server couldn't do an extra check to make sure the case actually matches. (Or perhaps IIS does such a check.)
Admin
Admin
I'm absolutely serious, TYVM. Case sensitivity is a huge mess that allows for all sorts of ugly abuses. Whenever I see someone writing something in C like "HWND hwnd;" I wanna throttle them. With the exception of a few proper nouns that are also normal concepts, a word means the same thing no matter how we capitalize it, so why shouldn't an identifier written as a word?
Admin
My brain came with a context sensitive parser built in. Didn't yours?
Admin
.Net programmers are fond of this too. I am not though. Why name your variable the same as the class? Do you declare Int int? What happens if you need a second int? int and int2? With no description of what the variable is doing? To me, naming the variable in a way that describes its usage in context is the most important way to self-document your code.
Admin
No, this is true. C is really easy to write a (non-optimizing) compiler for. This was, back in the day, considered a major feature of C, and according to some people is the reason for C's runaway success: http://www.jwz.org/doc/worse-is-better.html
Admin
[quote user="Mason Wheeler"][quote user="wtf"]
I'm absolutely serious, TYVM. Case sensitivity is a huge mess that allows for all sorts of ugly abuses. Whenever I see someone writing something in C like "HWND hwnd;" I wanna throttle them. With the exception of a few proper nouns that are also normal concepts, a word means the same thing no matter how we capitalize it, so why shouldn't an identifier written as a word?[/quote]
YVW.
Hm. I can sort of see where you're coming from. But your example is just bad naming conventions, and bad coders will come up with this sort of crap no matter what you do. I'd want to throttle that guy, too, but I'd probabaly end up throttling him for something else anyway. Case-sensitive languages make sense to me, but the rigor that they enforce (a given variable has a single representation) allows a laxity that you object to (the "same" string can mean multiple variables).
Okay, so you're serious and it's not hilarious. My bad. Now we just need more stringent enforcement of naming conventions, and it won't be an issue either way. Would bastinado be sufficient, do you think?
Admin
So you clearly missed the part where the OP said "if the class [name] is descriptive enough". "int" clearly doesn't qualify. If a class is called AssemblyTokenizer (to use OP's example) because that's what it is, giving it another name such as just "tokenizer" ends up being less descriptive rather than more. If you need an AssemblyTokenizer variable in your code, what would you suggest you call that variable? myAssemblyTokenizer perhaps? 'cos that really helps.
Admin
There are plenty of cases where you need a single instance of some self-documenting item. If you're reading a file, you're going to have one BufferedReader, and I'd rather it were called "bufferedReader" than something clever like "br". Or maybe you're setting up something in an MVC pattern, you might have a class called "Model", and instatiate it as "model". Or perhaps you're iterating through a graph composed of Nodes - "for (Node node: graph){...}"
If there's more than one instance of a class in play, then of course you need to use more descriptive names, but often this is not the case, and the more descriptive names just get in the way.
One-off ints are i, j, k, by convention. If they're persistent, they get descriptive names.
Admin
I occasionally make use of case-sensitivity.
I'm using cake, and on occasion I need to use an unrelated model, I'll Capitalize that variable: $Person
then I want to grab a person from the database, that variable will use the cakephp naming conversion $person
so I'd have $person = $Person->find( ... );
If you have a good code style guide then it an be used effectivly, but as with all things php, if you don't know what you're doing, you end up with messy code.
BTW I have a hammer downstairs, I could use it to smash all the windows in my house, does that make it a crap tool, or would doing that make me a crap tool?
Admin
Admin
[quote user="wtf"][quote user="Mason Wheeler"][quote user="wtf"]
I'm absolutely serious, TYVM. Case sensitivity is a huge mess that allows for all sorts of ugly abuses. Whenever I see someone writing something in C like "HWND hwnd;" I wanna throttle them. With the exception of a few proper nouns that are also normal concepts, a word means the same thing no matter how we capitalize it, so why shouldn't an identifier written as a word?[/quote]
YVW.
Hm. I can sort of see where you're coming from. But your example is just bad naming conventions, and bad coders will come up with this sort of crap no matter what you do. I'd want to throttle that guy, too, but I'd probabaly end up throttling him for something else anyway. Case-sensitive languages make sense to me, but the rigor that they enforce (a given variable has a single representation) allows a laxity that you object to (the "same" string can mean multiple variables).
Okay, so you're serious and it's not hilarious. My bad. Now we just need more stringent enforcement of naming conventions, and it won't be an issue either way. Would bastinado be sufficient, do you think?[/quote]
So will good coders. You may not like his naming conventions, but I doubt anyone would argue that Raymond Chen is a bad coder.
Count the HWND hwnd instances here: http://blogs.msdn.com/b/oldnewthing/archive/2003/07/23/54576.aspx
I never had any issue reading (or writing) code like that. I fail to understand your complaints, really.
Admin
You don't need case-sensitivity to do this in Java. Classes, methods, and variables can be distinguished synactically, so they don't need to share a namespace. This is perfectly valid (although terrible):
Admin
Somewhat off topic trivia question...
The traditional Unix file systems allow 254 of the 256 ASCII values to be used as characters in a file name. Name the other two.
Admin
Case is locale dependent. The end result is code may not be 100% portable internationally.
e.g. This code may execute differently in different countries.
var ASSERTION = TRUE
do if assertion equals true -- live another day sleep 24 * 60 * 60 else -- bye bye launch_doomsday_weapon end if while true
Admin
TRWTF is the unnecessary nesting. And VB.
Admin
Trick question. There are only 128 ASCII values. However, I think you're looking for foward slash '/' and NULL '\0'.
Admin
Off the top of my head, 007 and 012? Hearing your tty beep in the middle of an ls would be awfully confusing. And newlines would mess up the output.
Admin
Admin
FTFY
Admin
My all time favorite file name is .{BackSpace}
Admin
And quinternary, and, most shameful of all, you overlooked "sexternary".
Tsk tsk tsk.
AC
Admin
Oh man, that's just evil!! :-)
(I've had my share of 'fun' with files containing \r's in odd places.....)
Yours Yazeran
Plan: To go to Mars one day with a hammer
Admin
Admin
A search engine is going to think example.com/Index.asp is a different page from example.com/index.asp (and INDEX.asp and so on...) cluttering up search results.
Your browser is also going to think they are different, so things like the highlighted underline that shows whether you've visited this page before or not will be wrong.
Caching proxy servers retain multiple copies of the same thing in cache, consuming resources and reducing performance.
Same for your browser's cache.
I saw a CIO of a large organization fired because the auditor found a significant increase in security vulnerabilities compared to the previous web scan. What if the "increase" was illusory, because the same URLs were counted multiple ways? Clever way to get your CIO fired, I suppose...
Yes, clients can (and some do, each their own unique way) check the content to see if the two URLs are really the same. But dynamic URLs change from one load to the next, causing a lot of extra work and incorrect decisions because some lazy programmer can't remember when to use upper vs. lower case.
Those are just the first few examples I can think of. But you arrogantly assumed there weren't any, because you weren't aware of any.
So regarding "IIS not burning in flames", your inability to recognize a fire doesn't mean you're safe to sleep in a burning house.
And your assumption that it could all be handled at the server end means you don't have the necessary clue to be working web development.
Admin
I'm not sure of the PHP syntax for that, but in Perl this would lead you down this beautiful path:
$email = ${$::{(grep(/email_?addr(ess)?/i,keys %::))[0]}};
Ahhhhh.
Admin
Admin
Add a few more parenthesis and that could likely parse as valid lisp.... ;-)
Yazeran
Plan: To go to Mars one day with a hammer
Admin
Admin
Oh, you're case sensitive...WHY DON'T YOU GROW UP AND ACT LIKE A MAN, YOU JACKWAGON!
Admin
You case-insensitive clods!
Admin
Ohh.....too soon?
Admin
Is this a troll?
The less a compiler (or parser) has to work out for itself, the less chance you have of introducing a unintended subtleties. When I write code (or a document, for that matter) I mean exactly what I say (auto-correct sux too). If I have used 'x=0;' somewhere, and 'X=17;' somewhere else, I like the compiler to fail - it cannot (and should not) be certain that I was referring to the same x. Insisting on standards may be a pain in the ass, but it does create more readable programs (and I think better programmers).
Should compilers also try to find spelling errors in keywords and variables?
The less that has to be assumed, the less chance that the wrong thing is assumed. Compilers are essentially stupid, so they should be used to translate the bare minimum required. They should trust that the programmer knows what they are doing, and follow their commands exactly. That means that 'this' is different to 'This' is different to 'THIS' etc...
vs
(vs
potentially - yes it's bad, but it's possible)? The compiler should never assume these are the same...
What about: penIsland vs penisLand ? physiotherapist vs physioTheRapist? catsExchange vs catSexChange?
Admin
I = me i = loop counter
Two very different variables in my book....
Admin
I think anyone who thinks case-sensitivity isn't important is a lazy Gen-Y er or a VB programmer {I use the term loosely}
Admin
I have a suspicion that they're trying to plug into components other people have written, so they might not have had much choice over how to implement, but tried to cover all (known) bases. Bad, perhaps; understandable, maybe.
Admin
Is there a 'like' button somehwere?
Admin
I have a question for the case-insensitivists. Should someVar be the same as someVar? If case doesn't matter, typeface shouldn't either or should it?
Admin
This would never have happened in VB...
Admin
/Sarcasm
Seriously, would all you ignorance- and sloppiness-worshipers please off yourselves, and take your crappy software with you? Please?
Admin
I remember trying some languages/scripts that didn't care (definitley VB, and something else) - the result was very messy-looking, very unreadable code....
I find the same with HTML too - because nobody cares about case sensitivity in tags, people get very lazy about being consistent. Ultimately, consistency (above 'most all else) is a verra verra good thing....
Admin
PHP variables ARE CASE SENSITIVE, so the code works LIKE IT SHOULD.
RTFM. http://www.php.net/manual/en/language.variables.basics.php