Saturday, October 20, 2012

Oh Say Can You C


C#, pronounced "c sharp", is the programming being used to write the new web site. It was developed by Microsoft in the early 2000's.

C#'s great grandparent is a language known as C. C was developed around 1970 and was the first general purpose programming language I used for real work. C is still widely used today. The successor to C was C++, pronounced "C plus plus". C++ was developed in the early 1980's. The "++" is programmer speak for incrementing, adding 1 to, a variable. So, C++'s name was a clever way of saying it was just C plus a little more. Similarly, C#'s name is just a clever way of implying it is a better way to write C programs.

C# is one of a series of languages, Visual Basic being another example, that target Microsoft's .NET (pronounced "dot net") framework. The .NET framework is a standardized framework that theoretically lets us write an application once and have it run on many different kinds of machines. For example, it might run on a web server or a phone or a tablet. That's the theory anyway. Reality is a bit different.

Below is a very simple C# program. For some reason, programmers always demonstrate a programming language by writing a sample that says "Hello world". I don't know why. We just do. This program writes the phrase "Hello World" 10 times. Notice the "for" loop which uses a "++". This line looks really complex but it actually says something relatively simple. It says, start with an integer variable named "i" whose value is 0. Then, while "i" is less than 10, do everything between the "{" and "}" and add one, i.e. "++", to the variable "i".

Here is the output from the little program I just wrote. 

That's your 5 minute lesson in programming. Now you are a programmer.

No comments:

Post a Comment