Having just read a pretty interesting post by some guy who gets quite emotional about "else" blocks, the way to spot that this is an emotional reaction is the use of "Never-ever-under-any-circumstances-for-any-reason-what-so-ever", I have to admit I really liked the post. It was fascinating for me to see and have explained some other developer’s little mental twitch reflex when he sees "else" used in (what he considers to be) an inappropriate way.
The truth is I liked it because secretly I have one of my own. Actually I think its way worse than his. Why oh why did Microsoft see fit to include compiler keywords for primitive types? What purpose does it serve?
We have "string" for String, "byte" for Byte, "int" for Int32... Why? Seriously, why? "float" and "double", what's that all about, what we're talking about is single and double precision floating point numbers, if you're at least going to have compiler keywords for these they should be "single" and "double". If you're going to do this kind of thing, we already have "smalint", "int" and "bigint" from Sql Server, why not stick to that instead of "short", "int" and "long"? Has the whole world gone to madness?
Isn't it confusing for newcomers to figure out there are two ways of doing the same thing, not two different things happening? What's the point in the extra level of indirection? Isn't it better to really show that everything is an object (sorry that should be Object!) by not separating primitive types and everything else like this? It's ugly and completely redundant! Let's face it, anyone who's had a look through the String.cs file can tell you it's not exactly "primitive" in there anyway, that's no small code file!
I'll just come right out and say it, never-ever-under-any-circumstances-for-any-reason-what-so-ever use those wimpy little blue keywords when what you're really using can be much more beautifully represented as a soft calming green type name with a capital letter at the front just like every other type in the framework!
I always now write code completely using type names, and depending on just how OCD I'm feeling I have an even dirtier little secret... I actually go and change generated code, you know, when you have VS generate a method stub for you, event handlers for example which always pop out as button_Click(object sender etc etc... That's bad right? What's worse is that there is probably some way of changing how these snippets are generated so I can make the template give me the real type name but I'm afraid to go look for it in case I find it. The truth is I actually get a sick sense of satisfaction hunting down rogue compiler keywords. I think I have a problem.
Phew, the other guy was right; it does feel good to get it off my chest! That being said, I think he actually made a better case than I did. Is it just me then, does anyone else hate compiler keywords for primitive types? Can anyone even explain... No, not just explain, can anyone give me a good reason for the existence of these things? Even more interesting, does anyone else have any little emotional reactions to stuff like this? I bet some of you do...