When languages such as Java and C++ already existed, was C# really needed? Some say it was only developed by Microsoft to take on Sun’s Java?
C# was developed by Andres Hejlsberg and his team at Microsoft. In one of his papers, Hejlsberg commented that most programming languages had flaws. This led him to develop CLR (Common Language Runtime) – which is an environment that promotes the conversion of compiled byte code directly to machine instructions for a CPU to execute (that’s execute as in run, not execute as in hang unto death) – and later led to the to the creation of C#.
C# and Java
C# was released in the year 2000, and was quite similar to Java in functionality. Though Andres Hejlsberg always said C# shared more similarities with C++ than Java, James Gosling (the father of Java) and Bill Joy (Sun founder) labeled C# an “imitation of Java”. Some went as far as saying that both were just “boring repetitions of each other.”
CLR in use
Why C#
Originally, the language was named ‘COOL’, which was, well, not so cool. COOL stood for ‘C-like Object Oriented Language’. However, it was later renamed C# (pronounced ‘C sharp’), which is a musical note that is a semi-tone higher than the ‘C’ note. Thus, C# is a higher version of C.
C# is one of the most popular languages today and there are many reasons for this. It has many qualities that make it suitable for development for users at almost all levels. Fifteen years after its advent and following the release of many new versions, C# today has a whole slew of features which make it unique and its use inevitable. Let’s discuss some of them here.
COM (Component Object Model)
COM, or Component Object Model, provides C# with capabilities such as platform independence and integration of objects, which need not be in the same development environment or even on the same computer. COM along with the DotNet framework promote interoperability. Versioning helps in easy deployment, while support for web-based integration is provided by XML.
Dynamic binding
C# is a strongly typed language, which illustrates the fact that all the variables are resolved at compile time. But then the question arises: How does C# simplify access to Document Object Model (DOM) or COM API’s? Dynamic Binding does this for C#. Dynamic Binding delays the process of resolving variables from compile time to runtime.
Scalability
Scalability allows C# to be suitable for handling enterprise applications and projects on a large scale. MVC’s based on DotNet are used to design web constructs that are scalable and updatable as well as to establish the assembly version, digital signature, identity, culture, etc. Updation is useful when you need to delete or update old files to scale your application.
Other features include robustness, which can be attributed to Garbage collection and type safety attributes provided by C#. Security in C# is assured through intrinsic code trust mechanisms. Also, the replacement of pointers (as in C++) by automatic memory management adds to this feature.
Hello World This is the way Hello World is programmed in C#.
using System;
class Hello{
static void main() {
Console.WriteLine(“Hello World”); }
}
C# is a good language to start with for the novice programmer, but you’ll need to get some experience with Object-oriented programming before exploring C#. This is why people usually get to C# only after learning C++, or other OOP languages.
Now, back to the program listed above, class name doesn’t need to be similar to the file name (a feature observed in Java). The output is written on the console and ‘main’ is accompanied by a ‘static’ keyword.
While developing software, the most important factor for choosing a language is the environment in which it will be working.
Probably one of the major reasons for the success of C# is the fact that it’s the best suited language for Windows servers, Windows clients and now even Windows phone applications. The reason is obvious: its development is being overseen by Microsoft.
Some benefits of learning C#:
C# is used across many applications. Let’s look at the scope of the language in the industry today.
Gloria Victis: A game developed on Unity
As discussed before, the support by Windows gives C# one of the best programming environments available for it – there are numerous IDE’s available. The most suitable development environment is undoubtedly Visual Studio because of the toolkits it provides and the ease of design and deployment one experiences with it. But, apart from Visual Studio there are several other IDE’s such as SharpDevelop, MonoDevelop, xacc, cSharpStudio, QuickSharp and Fireball. CodeEditor available for C#. We’ll briefly discuss some of them.
C# is used in mobile application development
‘Sharpdevelop’ is an open source IDE for C#. ‘MonoDevelop’ aims at developing support for C# in the Linux environment and aims at introducing all the features currently present in Windows in Linux too. ‘xacc’ is mainly used because of its debugging support as well as its support of various languages (27 of them).
There is a tremendous amount of online resources for anyone from beginners to advanced coders to learn C#. There are MOOC’s such as ‘Game Programming with C#’ (Coursera) available, and also websites such as redhoop.com or noexcuselist.com that can help you stay updated with various MOOC’s available and pick from the best of them.
Websites such as ‘pragimtech’ and many others keep posting well-crafted videos on their YouTube channels, so make sure to check those out.
Book worms should start with this list::
Component-based Development with Visual C# (M&T books) − Ted Faison
C# Essentials, 2nd edition (O’Reilly) − Ben Albahari, Peter Drayton & Brad Merrill
A Programmer’s Introduction to C#, 2nd edition − Eric Gunnerson
Inside C#, 2nd edition (Microsoft Press) − Tom Archer
C# in Depth − Jon Skeet
That’s the way development on Visual Studio happens.
Given the wide expanse of the language, we suggest you build certain projects, or at least go through these links for some knowledge on how to get started with them.
W3schools introduces the web development side of DotNet framework to you. Going through it would provide you with an idea regarding website building with the help of C#.
Apart from this, we recommend actually implementing, maybe, a small website just to get your feet wet with C#.
Code project has numerous projects available covering almost all the fields of C#. Going through them would make you aware of the expanse of C#. You can pick any of them and start working on it to try your hand at C#.
For tutorials on 15 other hot programming languages go here.