Home > Guides > Programming > .NET and Windows Programming

Toggle Open Guide Table of ContentsGuide Contents

Close Table of ContentsGuide Contents

Close Table of Contents

10 Things I Hate About C#

Last updated Mar 31, 2006.

When announced, C# was described as a brand new language designed specifically for the .NET platform. There is a lot to like about the language, as it combines some of the best ideas from C, C++, Pascal, Java, and a smattering of other languages and systems. However, there are some things that are just wrong, and a few subjective things that I find uncomfortable.

1. Case Sensitivity

Case sensitivity in programming languages is perhaps the worst ever idea in computing, with the possible exception of an operating system that applies case sensitivity to file names. Perhaps it’s not as bad an idea as spaces in file names. In any case, it ranks right up there in the top five. It’s just crazy that MyVariable and myVariable should reference different things. I realize that this idiocy was commonplace with C and C++ programs, where ALL UPPERCASE was used for preprocessor symbols and various casing schemes were used to make code more or less readable, depending on the author’s whim.

The case sensitivity in C# is ridiculous when you consider that the .NET platform for which the language was designed is aggressively not case sensitive with respect to public APIs. The Common Type System specifies that all symbols exported from an assembly are case insensitive. I can’t understand why anybody would add case sensitivity to a language that’s designed specifically for .NET.

2. Operators ^, !, ~, &, &&, |, and ||

I probably missed a few, but I think you’ll get my point. The use of these operators is, again, taken from C and C++. But I think it’s also homage to the idea of the super cool programming geek who revels in the use of baffling symbols where perfectly clear and serviceable names would do just fine. It’s a continuation of the "small code is faster" mentality that’s resulted in so much horribly cryptic "optimized" C that runs slower than clearly-written equivalents.

I first came to C in 1980, after a few years with Basic and about 6 months studying Pascal. There was a lot to like about C, but I just couldn’t understand why the programs had to look like somebody let a semi-artistic monkey loose with a bunch of symbols and lower-case letters. Given any other language at the time, I could spot and understand conditional expressions because they used real words like and, or, and not. But not C! Oh, no. They have to use &&, ||, and !. Except when used in expressions. You see, && is a conditional AND operation. An arithmetic AND operation is written, &. This was required because C’s grammer made it possible to confuse conditional and arithmetic expressions.

The grammer of C# should have been fixed to make those distinctions unnecessary. Moreover, the C# development team should have gone back to the more reasonable and, or, not, and similar words rather than keep the cryptic C symbols for these operators.

Discussions

Copies of the array?
Posted Dec 23, 2008 03:40 PM by luige21
1 Replies
Hi
Posted Dec 5, 2008 05:10 AM by ajay2000bhushan
2 Replies
You have no clue.
Posted Jun 10, 2008 03:28 PM by theinternetmaster
1 Replies

Make a New Comment

You must log in in order to post a comment.

Related Resources

Jim Mischel"Highly unlikely" does not mean "impossible"
By Jim MischelJuly 18, 2009 No Comments

One of my programs crashed the other day in a very unexpected place.  A call to System.Threading.ConcurrentQueue.TryDequeue (from the Parallel Extensions to .NET) resulted in an OverflowException being thrown.  Investigation revealed a pretty serious bug in the System.Random constructor.

It's Here; Put Away Your Pre-Conceptions on What an OS Must Be: Part II
By John TraenkenschuhMay 24, 2009 No Comments

In the last blog in this series, Traenk relates his first experiences with computers and with coding.  But now, some years have passed. . .

It's Here; Put Away Your Pre-Conceptions on What an OS Must Be: Part I
By John TraenkenschuhMay 24, 2009 No Comments

Traenk relates his past experience with Operating Systems that goes back 25 years, ok, more than that but he ain't tellin'

See More Blogs

Informit Network