Thursday, December 09, 2004

# as a tack

Microsoft went one semitone beyond C to provide 277Hz of programming goodness, and they certainly struck a chord ... (OK enough jokes about the name)...
Yes I'm referring to one of the world's newest languages, C# (pronounced of course, C-Sharp), which came into being around 2002 as the poster-child of Microsoft's .NET Framework.

I've been using it today (and I love it) so I thought I'd do a bit of a mini-review.
First of all, the story behind it is... The year is 2001, Microsoft has just made an historic settlement with Sun Microsystems that forces them to cease using Java forever. Microsoft is currently selling one of the leading software development tools, Visual Studio, which includes Visual Basic 6.0, Visual C++ 6.0 and Visual J++, the Java compiler. Goodbye J++.

So what do they do? Why, they're Microsoft. Build something better and attempt to take out Java! Enter .NET, Microsoft's new plan for world domination. .NET has a Virtual Machine just like Java. Although currently its only for Windows, this makes it highly versatile and potentially cross-platform (if you look at how the .NET framework is written, all the Windows-only stuff is separate from the core stuff). However, the brilliant move on Microsoft's part is not to make ONE language (such as Java) support .NET, but instead port all the languages to .NET.

Visual Basic (Microsoft's own very popular language) is completely redesigned for .NET. C++ (Extremely powerful, fast, popular language) is given some "additions", to make it compatible with .NET and yet still compatible with other C++ code and apps at the same time (brilliant!). And they introduce a new language, C# which is designed from the ground up to take the best elements from Visual Basic, C++ and Java and write it directly into the .NET Framework. Its not as fast or powerful as C++, and not as friendly english-style as Visual Basic, but its a good medium.

The first thing is, C# is at such a good medium that if you know any one of VB, C++ or Java, you should easily be able to pick up C#. Its syntax is extremely close to C++ or Java, but the ease at which you can do things (like concatenate strings, etc) makes it feel a lot more like Visual Basic. So VB users just have to learn to use lots of curly brackets and put semicolons everywhere, and C++/Java users just have to learn to relax a bit ;)

A great example of the "best-of-both-worlds" is that strings are both stringy-strings like in VB, and also char arrays like in C++. (And the only other language I know which does that is Haskell).
Also C# has no pointers to speak of at the top level, so its a lot like VB in that respect (and much easier to use and C++) but you can also write specific functions as "unsafe" and you are allowed to use pointers within those functions.

With all the similarities to VB, here is the reason why I think I will choose it over VB in the end: it has superior array-management. Nearly as easy as VB, but it lets you pass arrays around as pointers which means you can do better optimisation.

Also, the editor is lovely. Like the VB.NET editor, it picks up errors as you type (underlining them unobtrusively) and it has a whole lot of autocomplete, etc, features. C# is also the only .NET language which allows you to write comments in an XML-style which can then be read by the editor and used to automatically in popups and in the object browser. So its a good environment to work in.

As evil as Microsoft are, I think in the end, its whats best for you and your software. C# and .NET are a good thing for the many. Now we play the waiting game, and see which wins the big battle... .NET or Java?

Visual C# Developer Center
Visual Studio Home
You can try C# for free with the .NET Framework SDK

"Now we play the waiting game.....
.....
Ahh the waiting game sucks. Lets play Hungry Hungry Hippos."
- Homer Simpson

4 Comments:

At 3:58 am, Blogger Toria/Deb said...

Very nice summary of which I understand absolutely nothing LOL. Love the Simpson's quote at the end of it though ;) hehehe

 
At 12:02 pm, Blogger Andrew said...

man... you write long blogs... but they're cool

 
At 6:12 pm, Blogger Eat_My_Shortz said...

Well I hope not all of them are as long as this! There was just a lot of content to talk about!
Thanks for commenting guys.

 
At 11:38 am, Blogger Tim Cuthbertson said...

.. "and C++/Java users just have to learn to relax a bit"

bwahaha :D

and yes, end quote is teh good also.

 

Post a Comment

<< Home