By Danish Sami
Unlike the designer of the software applications, the application developer keeps
concentration on development issues and it is the job of a programmer to choose the right
language to get the job done.
In this article I will provide brief introduction about the CSharp language and then compare
it with the most powerful lanaguages used today by every developer.
Introduction
With the advent of Microsoft .NET platform it is now very easy to port your software from
one platform to the other as depicted by the logo “Write Once Compile Anywhere”. If you
are a java developer and have gone through the concept of .NET platform you will find it as
similar as java platform with little modifications.
With the java programming language you can develop your program once and deploy
anywhere as long as it supports java in the form of Java Runtime Environment. The Runtime
provides memory and I/O management seamlessly so the developer will be free of manging
objects and with the more crucial mutual exclusion, a phenomena frquently used with I/O
managment.
CLR and MSIL
Microsoft provides similar functionality in .NET platform by introducing CLR (Common
Language Runtime); you can develop your application in COBOL, modified it in C#
(pronounced as C-Sharp), used in ASP+ and run it on any platform as long as it supports
CLR. This is done through the magical language developed by Microsoft known as Microsoft
Inermediate Language or MSIL, which the CLR needs to run the application. The CLR has
a JIT or Just In Time module which can translate the MSIL into machine specific code.
As the name implies MSIL is an intermediate code or a language for the CLR having some
instructions and directives – in this article I’m only focusing on usefulness of C# and .NET.
In this series of my future articles I’ll explain how the .NET compiler tranaslates the C#
code into MSIL and how the CLR understands the MSIL. You can also generate this code
yourself. It is a better practise to know about MSIL generated by the .NET compiler so in
this way you can better understand the language itself, because you know the output, you
can better program the input.
Now we have a little knowledge about the .NET platform and have sufficient knowledge
abou the foundations now it’s time to take a look to the lanaguages supported by the .NET
platoform. There are many lanaguages supported including Visual Basic .NET, VisualC++
.NET, VC#. Net, Visual J#. Net and many more. By the time this article is writing .NET
supports twenty languages including Eiffel .NET, Cobol .NET and many others.
C# vs. Java, C++ and VB
In this article I have choosen C# as the developers choice, because Microsoft has provided
the definition of C# language as follows:
? C# is as elegance as Java
? C# is as powerfull as C++
? C# is as productive as Visual Basic
First we will compare C# with the Java language, if you are a Java developer you know that
Java provides buitlin class libraries or packages support through which a developer makes
any application in a very small span of time. Microsoft has also provides class libraries
bundles in C# known as namespaces. A simple use of namespace is the Math.Sqrt() library
function which helps in acquiring square root of numeric data and in this way you don’t have
to write a single line of code to implement the square root. It means that the time, which
you were previously taken in implementing the libraries have reduced to a little and you can
develop your application very fast and error free.
All traditonal Object Oriented developers, which likely to programmed in C++, can now
develop their software in C# also. C++ provides more security and robustness in developing
software applications and makes the developer the master of the domain. Microsoft has
adopted all the features supported by C++ language and also introduces some new
features, which are new to C++ developers. Like the sealed keyword provided in C#
language which restricts any one to inherit the class even if the class declares to be public.
The power of C++ comes into practise when programmed with Object Oriented
methodology. C++ is handy in solving large and complex business problems and still being
used. Luckily C# also provides such funtionality and with this programmers who previously
programmed in C++ can switch very easily to C# with little modification and with smooth
programming curve.
Visual Basic is the language used today by the Project Managers if they choose RAD (Rapid
Application Development) as they have to fullfill their client’s requirement in small span
of time. Visual Basic provides rich set of controls, classes, API’s and runtime libraries
through which a developer can develop the application with magical power. Microsoft has
also included many features available in Visual Basic into C#. One of the few similar Visual
Basic language constucts found in C# are:
- For each loop
- Do while loop
- While loop
- For loop
Like Visual Basic, which provides rich set of controls for GUI (Graphical User Interface)
development, Microsoft has also provided such functionality in C#. It means that if
programmer who previously works with controls in Visual Basic to create font-ends can
switch to C# and create the same with extra bonus.
To provide maintainability and reusability, Visual Basic provides a feature called COM
(Component Object Model), with the help of COM interoperability you can deploy your
application with complete security and distribute it to the clients, which they can plug into
their applications and use without the worries of implamentation.
C# also provides COM functionality having features like the setters and getters method plus
new ones including indexes, delegates, events which provides enhanced COM features.
With COM advanced features you are now free from the old so-called “Dll Hell” situation and
also from versioning problems.
Together with the .NET Framework, C# also provides great security. Now it’s very easy to
prevent the programs from unauthorized access to your system resources. Now the codes
generated through .NET compilers have public key encryption with them, it means that in
future you can only allow programs to run on your system with valid credentials and the one
who you allow.
After reading this article you have a better understanding about the .NET and C# language.
And I think you have planned to develop your future applications with C# and .NET
Framework.
Before starting you need the .NET Framework and .NET langauge compilers and tools, these
can be easily available from Microsoft website for download.
Conclusion
With the advent of Microsoft .NET platform and languages like C# you can develop
programs that can run on every platform as long as it supports the CLR (Common Language
Runtime). In the end I will finish the article with these features when comparing to Java,
C++ and VB that it is as elegance as Java, as robust as C++ and as productive as Visual
Basic.