Saturday, March 17, 2012

Why C# Is Not My Favorite Programming Language

Why C# Is Not My Favorite Programming Language:

What a bunch of blarg...I love C#. I don't want to make my points by attacking the author personally, but the page is so full of "BS".

1. Default Object Lifetime Is Non-Deterministic

It is not supposed to be deterministic! It is this way on purpose so we can focus on what we want to do rather than worry about allocating and deallocating memory. Only a control freak would want to control every byte used.
The example 'AutoLock' class as shown does not let you control when the lock is Unlocked. The lock() functionality in C# provides way better scoping.

 I am supposed to remember to use using, or litter my code with finally blocks.
Um, YES... Using the language correctly will work wonders.

2. Object Lifetime is Not Determined by Scope
Lol. Not even going to honor this inaneness.

3. Every Function Must Be A Method
I repeat "Object Oriented". Why would you want a global non-namespaced function called "Sin"? Can you understand why that would be so bad? Btw, learn about C# extensions if you don't like the taste of this sugar.

4. Containers Have Algorithms As Methods
See my response to #2.

5. Default Comparison Behavior Is Dangerous

Dangerous? No. Gotcha-inducing, yes. When you don't pay attention to what you really intend to compare. Btw, I think the most Vector 'classes' are actually structs.. anywho...


6. Operator Overloading Is Severely Broken
Only when you implement it wrong.

Conclusion: for someone so smart, you really need to grok C# and use it the correct way.