RISE-02

C# and .NET for Java Programmers

Judith Bishop, University of Pretoria

Linköping, December 10, 2002, 13:15-17.00


A new language brings with it new opportunities and challenges. Yet programmers cannot easily let go of investment in an existing language. We are faced with this dilemma with C# and Java. Is it worth moving to C# and what would be the benefits? On the other hand, can the two languages co-exist, enabling us to take the best from both? Here we will give insight into both answers.

This tutorial looks at the best features of C# and how they can be incorporated seamlessly into programs, even those that are currently based on Java. Language features covered include properties, collections, indexers and value semantics. Several advanced oops features are implemented in C# in a novel way, and make life easier for the programmer. Those mentioned here are reflection and serialisation on the net via XML and SOAP. Several examples will be examined and source code will be made available to the attendees.

C# comes along with the .NET environment which has to be taken into account as soon as one moves to net-centric computing. .NET is based on server side processing, and the central role of the Common Language Runtime (similar to Java's JVM) means that languages outside it could well be excluded in the future. Java is outside the CLR and therefore Java programs must either be converted to Microsoft's J# language or be linked to other .NET programs. We have investigated how such linkage can be accomplished. We show how C# can be used to mimic the client side processing of an applet and how it can be called from Java. Reference is made to work on a platform independent XML-based GUI generator (available for both C# and Java), which can free programmers from additional Microsoft software, i.e. the forms designer of Visual Studio. Some of the examples are run on Microsoft's Open Source C#, called Rotor, which is available on FreeBSD Unix in addition to Windows XP.


Lecture outline

Exciting new features of C#, as compared to Java
Case studies of programs in C#
Outline of .NET and the CLR
Linking Java and C#
Platform-independent GUI generator
Creator: Johan Sundström / Last modified: Friday, 04-Oct-2002 17:35:19 CEST