#52WeeksOfCode Week 19 – C#

Week: 19

Language: C#

IDE(s): MonoDevelop (via Xamarin Studio), MS Visual C# Express 2010

 

History (Official):

[from a Microsoft Press Release dated June 26, 2000]

 

“REDMOND, Wash., June 26, 2000 — Microsoft Corp. today announced Microsoft® C # (

“C sharp” ), a modern, object-oriented programming language built from the ground up to exploit the power of XML-based Web services on the .NET platform, which was announced last week at Forum 2000. With its Visual C++® development system heritage, C # will enable millions of C and C++ developers to use existing skills to rapidly build sophisticated XML-based .NET applications. To simplify integration and interoperability, Microsoft is working with ECMA, an international standards body, to create a standard for C # , enabling multiple vendors to deliver the language and supporting tools.”

History (Real):

There are four players here. Two of them, C# and .NET, are obvious. The third one, the Web, is mentioned almost as an afterthought. The fourth is the then-mysterious acronym XML. To see what actually happened on that fine June day in 2000, we need to travel further back in time.

  • In 1994, Bill Gates, then CEO of Microsoft, gave a keynote speech at Comdex, a major computer and technology expo, where he said,  “I see little commercial potential for the Internet for at least 10 years”.
  • In 1995, Bill Gates published a book titled “The Road Ahead”. In the original edition, he dismissed the Internet as simply a precursor to the true Information Superhighway, which he envisioned would be based on proprietary services such as CompuServe and Microsoft’s own MSN.
  • In 1995, the programming language Java was introduced by Sun Microsystems. Java was intended to produce applications that would run on every operating system and even in Web browsers through small programs called ‘applets’. In theory, Java could be used to create a desktop application (like say, a word processor) that ran in a Web browser.
  • In 1995, Amazon.com went online.
  • Just weeks after the first edition of “The Road Ahead” came out, Bill Gates redirected Microsoft’s corporate vision towards dominating the Internet.

C# and .NET were direct responses to Java and the Java Framework, respectively. XML (EXtensible Markup Language) is related to HTML (HyperText Markup Language) in that they are both invented for use on the Web. However, while HTML is designed to display data (ex. a Web page), XML is designed to describe data. So XML could be used as a ‘wrapper’ to send proprietary content (like, say, a MS Word document) onto the Web.

XML was going to be Bill Gates’ secret weapon to move the Windows desktop (and it’s associated applications) off of Windows PCs and into everyone’s homes, regardless of what hardware or operating systems they were using. Gate’s vision of ‘a computer on every desk and in every home, running Microsoft Windows’ suddenly had a very good chance of coming true.

Apart from the ‘running Microsoft Windows’ thing.

So what happened? Well, C# is still a decent language, with several advantages over Java. But C# doesn’t dominate the Web as originally envisioned. The Internet is an open system, built on open standards and as such there continues to be a churn of innovation, with many competing languages and platforms.

Bill Gates’ vision did come to pass in the form of cloud-based services, some open, some not. Microsoft’s competitors are now all in on the game, each with their own walled gardens.

(This article was written with Google Docs.)

Discussion:

Since C# was designed to become an open standard, I was spoiled for choice with respect to producing the code for this entry. I settled on MS Visual C# Express 2010 and Xamarin Studio on Windows 7.

Both IDEs produce C# applications but I wanted to see how they compared with respect to code and general usability. Both are free with additional features enabled in the paid versions. Xamarin came out of the Mono Project, an attempt by open source developers to port the C# language and the .NET framework to non-Windows platforms. Versions of Xamarin are available for Windows, Mac OS X and Linux, with a similar look and functionality. Xamarin has also partnered with Microsoft to produce add-ins for MS Visual Studio.

As expected, Visual C# Express was a pretty straightforward installation. The installer prompted me to install the .NET framework and once I agreed, it downloaded and installed. To keep things simple, I built a console (text-only) application that would simply open a command prompt, print ‘Hello World!’ and then wait for me to press a key.

Hello World in Visual Express

Hello World in Visual Express

This code was straight out of the MS C# tutorial. (Literally. I just copied and pasted.)

I ran it and everything worked as advertised.

Hello World text

Hello, World!

Now for Xamarin Studio.

On the download page for the Xamarin installer, there was a note that I had to install GTK# first. GTK# is a collection of graphical routines that Xamarin uses to draw its user interface. Once I did that, the install was also straightforward.

I copied and pasted the code from my Visual Express solution directly into Xamarin Studio.

Hello World in Xamarin

Hello World in Xamarin Studio

The interfaces were quite similar, so I didn’t have trouble figuring out how to build and run my code.

Hello again!

Hello again, World!

This error was the only difference between the two code runs. As for the code itself, the syntax is very similar to Java. When it was first introduced, C# was a source of a lot of excitement (mainly among Microsoft developers) and controversy (mainly among non-Microsoft developers).

It’s a nice language, but it’s just not that interesting anymore.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s