1.3 Multiple .NET programming languages and VS.NET


.NET is about multiple programming languages. VS .NET, the new version after Visual Studio 6.0, is a good tool for writing .NET applications and components . VS .NET comes with a few programming languages that are supported by Microsoft: C# .NET, VB .NET, Visual C++ .NET, JScript .NET and the last (surprising) inclusion, J# .NET. [5] Other vendors and educational institutions are independently developing other languages, or adapting current ones, to target the .NET platform. At the time of writing, there are about 30 such languages ready or in the process of being developed. [6]

[5] The announcement of J# was an eleventh- hour surprise. When VS .NET was announced, apparently there hadn't been any plans to include a successor for the defunct Visual J++. (In fact, the first final release of VS .NET does not include J#. The final version of J# was recently released in July '02.) Visual J++ was prevented from evolving further after Microsoft lost a court case involving the illegal extension of the Java programming language. Sun alleged that Microsoft had violated the Java license agreement, and had attempted to kill off Java's platform independence. I believe the decision to include a Visual J++ successor in VS .NET is an attempt to provide another transition path for the huge number of Java developers out there when they move over to .NET development.

[6] More well-known examples of .NET languages include Eiffel, COBOL, Fortran, Perl and Component Pascal. The rest are mostly obscure unheard-of languages used only for specific academic purposes. For a list of official "language partners", check out http://msdn.microsoft.com/vstudio/ partners /language/default.asp.

The idea is to have a huge heterogeneous base of .NET developers writing .NET codes in their preferred language. It doesn't matter if a module is written in C# or J#, or managed C++, they all behave similarly when running on the .NET runtime.

This is very unlike Java's strategy. As shown in Table 1.1, Java insisted on having only one programming language (namely Java itself) and the ability for the codes to be run on multiple operating systems. .NET speaks about having the possibility of writing code in a theoretically infinite number of languages, but running them on a single operating system (Windows). [7] , [8]

[7] Is it possible for .NET applications to run on operating systems other than Windows? See section 1.10 for a discussion.

[8] Some may argue that the Java platform can be multi-language too. A good example is the Jython language which is an adaptation of Python so that the source codes compile to Java byte codes. Nevertheless, I would still consider the Java platform a single-language solution. How many developers use Jython instead of Java? In fact, most have not even heard of Jython.

Table 1.1. The two platforms emphasize different things

Java

.NET

One language (Java)

Multiple languages (C#, J#, managed C++, VB .NET, etc)

Many platforms (operating systems)

One platform (Windows)

As far as Microsoft is concerned , the ability to write .NET code on C#, J# and VB .NET is an essential move to provide a smooth transition for current C++, J++, and VB 6 developers to move over to .NET. [9]

[9] Try breaking the news that Microsoft will no longer be supporting VB for .NET, and that all VB 6 developers will have to learn a new programming language (with a weird name called C#) closely related to the dreaded C/C++. There would be a global software revolt with current VB developers dumping Microsoft altogether. There are so many VB developers out there now and Microsoft somehow has to protect their intellectual skill set!

The multi-language nature of .NET is generally seen as an advantage. It gives developers more choice. The idea is that if you are already a VB 6 developer, move on to VB .NET instead of C#. Despite having to learn some new stuff, [10] at least you are more at home with the comfort of the familiar VB syntax.

[10] There's a great deal of difference between VB 6 and VB .NET due to the inclusion of true OO support (which is absent in VB 6) such as polymorphic method invocation and class inheritance. There are other new features such as multi-threading support. I suppose there is a wider gap between VB 6 and VB .NET compared to C++ and C#, or even Java and C#. I have read articles on how VB 6 developers are commenting that VB .NET is a whole new language itself. Well, at least the syntax is familiar to VB 6 developers.

Another point I would like to make is the true language interoperability nature of .NET languages “ something I really like.

True language interoperability [11] means that:

[11] The closest COM ever got to language interoperability is that you can write a COM component in VB 6 and call its methods from a C++ class, and vice versa. All this is achieved via a language-independent COM interface. There is no way you can do anything more than that using COM. .NET brought new meaning to language interoperability never seen before.

  • You can write two separate classes “ one in J# and the other in C#.

  • These two classes can work with each other as if they have been written in the same language “ the J# class can invoke a method in the C# class and vice versa.

  • Better still, you can actually inherit one of the classes from the other despite them being written in different languages!

VS .NET is a true integrated development environment that enables you to open J# files, C# files, and VB .NET files all within the same work space. It has a debugger which actually steps through the codes written in different .NET languages during a trace, so that you can see exactly which line of which class is being stepped through regardless of the language that class has been written in.

How is this support for multiple languages achieved? The secret lies in MSIL and the .NET CLR. See Table 1.2.

Table 1.2. Parallel components between the Java/J2EE solution and the .NET solution

Java

.NET

Java source codes

.NET language source codes

Java byte codes

MSIL

JVM/JRE

.NET CLR/.NET runtime



From Java to C#. A Developers Guide
From Java to C#: A Developers Guide
ISBN: 0321136225
EAN: 2147483647
Year: 2003
Pages: 221
Authors: Heng Ngee Mok

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net