Pascal was the first proper language I learned after BASIC, and my IDE of choice was Turbo Pascal, the creation of Anders Hejlsberg, the same man who has now brought us C#. I still rave nostalgically about the brilliant help system built into TP, but when it comes to C#, I have a slightly different view.
I don't hate C#, but I don't love it either. However, that doesn't mean I have a love-hate relation with the language, those emotions are far too strong. Rather, I consider it to be more of a like-dislike relation. Naturally, I focus on the dislikes. Here's the list:
Everything is classes, just like Java, and just like Java, it annoys me. What's wrong with the odd global helper procedure for those pointless-to-classify tasks? The same basic thing can obviously be accomplished by declaring public statics, but it's that much more bureaucratic framework code, just to please the OO fanatics who blindly believe that all globals are evil. The only thing that kind of design accomplishes is an abundance of classes called Library, Framework or System. Suggesting that I use a singleton instead won't improve my mood, either.
Then there's the mollycoddling. Bounds checking? Garbage collection? No pointers? (That last one is a lie of course, but I'll get into that in a bit.) Apparently it's much too deviously difficult or at least much too time consuming for me, a pitiful dev, but I'm pretty sure I can handle the memory management myself, thanks. In fact, I rather prefer to know what's going on under the hood, if I may.
These days, pointers are one of the devil's temptations. Only the most hardened of veterans may use them, and even then only if they incantate the keyword equivalent of a contamination suit, "unsafe". Much easier for the developer, indeed. But does that mean the language is void of pointers (pun not intended)? Au contraire!
In fact, most variables transcending the complexity of an integer that you might want to declare in C# are pointers, or "reference types", as it were. That is, they are pointers to objects. Have a look at this:
MyClass c = new MyClass();
someObject.SomeMethod(c);
That method call looks like it takes pass-by-value parameter to me. It does, in fact. It's a pass-by-value of a pointer to the object c. Of course, that means the object can be altered by the called method:
void SomeMethod(MyClass x) //pass-by-value?
{
x.ChangeObjectsInternalState(); //oops
}
Can someone explain to me how this is more clear than waving the red flag of pointers in order to signal that what's happening is really a pass-by-reference?
void SomeMethod(MyClass * x); //unmistakable
Also, boxing doesn't improve on any of this.
Something that really has me gritting my teeth is the lack of support for variable shadowing. Googling the matter has informed me that shadowing "is confusing". Huh? I suppose the concept of polymorphism is also confusing for a beginner, but they didn't take THAT out of C#, now did they? How hard can it be to understand that any given variable exists in a, likewise given, scope? Why not skip templates as well? Oh but wait, C# didn't even implement their templates variety "generics" until version 2.0! What was up with that?
Speaking of stuff that's missing from C#, why won't optional parameters with default values be implemented until version 4.0? What is it they're so busy working on instead? Yeah I know, LINQ. As if anyone enjoys SQL so much that they actually want to be able to use it on arrays and linked lists. Get a grip.
There are other things besides LINQ that I fail to appreciate. WCF, for example. Tell me, why is it that I need another layer on top of Berkeley sockets? Maybe connect() is too difficult a concept to grasp? But then again, I don't really care about WSDL or SOAP or anything remotely connected (pun scornfully intended) to "web services".
In the end, I just prefer executables that don't come with a lot of extra luggage. My PC is perfectly able to run software without an extra layer on top of the already installed extra layer that is Windows. In fact, I'm one of those who longingly recall the days when each piece of software came on its own boot disk/tape/cartridge. Who in their right mind forces their users to download and install a virtual machine just to run their software? Sure, soon .NET will have insinuated its way into every Windows machine out there, but that won't stop me from despising the idea in the first place. Unfortunately, it's painfully obvious that bloat isn't exactly high on MS's priority list of concerns.
Wednesday, February 4, 2009
Subscribe to:
Post Comments (Atom)

2 comments:
While you are the devil I will be the angel! =)
WSDL/SOAP is about standards. The problem is that each coder write their own crappy layers and in the end nothing works with the other. Please save us from your own crappy layers!
Of course, some situations demand or excel using basic sockets - but they are few.
Let us embrace all dying java developers who wants to use our .NET web services. They deserve a second chance!
You're mistaken - I'm the angel.
Ah yes, "layers", that's proper consultant speak. Of course, we're talking about standards on a level with LEGO. You're right that Java devs are sure to flock under the .NET umbrella though. While it might put bread on their tables, it still doesn't impress me.
Post a Comment