TechBookReport logo

Keywords: Java, J2EE, C#, .NET, CLR, BCL

Title: From Java To C# - A Developer's Guide

Author: Heng Ngee Mok

Publisher: Addison-Wesley

ISBN: 0321136225

Media: Book

Level: Introductory C#, Intermediate Java

Verdict: Good, but doesn't go far enough

Like it or not, the future's going to be multi-platform, multi-language and multi-protocol. The next few years are not going to resolve to .NET or ONE, but a world of mixed architectures programmed in a number of different programming languages. Given this very likely scenario, it makes sense for developers to arm themselves with at least a passing knowledge of different languages and a basic understanding of how the different platforms are put together.

In the case of .NET, it makes most sense for Java programmers to pick up some knowledge of C# given its origins and the popular perception of it as a Java-killer. It certainly makes more sense than trying to pick up VB .NET from scratch. The thinking behind this book is along those same lines; as the title proclaims, it aims to introduce C# to developers already well-versed in Java.

With this rather limited brief in mind, Heng Ngee Mok takes the obvious approach of pointing out the numerous similarities between Java and C#, both from an architecture (JVM vs CLR) view and a syntactical point of view. The starting point, obviously is a quick introduction to the .NET architecture, specifically how this relates to programming languages through the use of the Common Language Runtime.

A key part of the book compares Java and C# syntax directly. Common concepts are explored, differences in syntax or terminology outlined and code used to illustrate the point. One annoying aspect of the book is that in a number of places the program output doesn't actually match the code - it feels as though some last minute changes have slipped through the proof-reading phase. It's not a disaster, but it's annoying all the same. On the plus side the book makes no use of Visual Studio .NET, and all the code examples make use of the CSC command-line compiler which is available for free from Microsoft.

One thing that is immediately apparent is just how close the similarities between the two languages are. It's not just a common history in C and C++ at work here, C# borrows heavily from Java too. However there are areas of clear difference too, and the book covers these too. Chapters 24 through to 29 (which make up part 6 of the book), cover a set of C# specific features, from pre-processor directives to C# structures, attributes and writing unsafe (pointer) code. Other topics, such as the use of delegates, are covered in other parts of the book, so overall there is a reasonable coverage of those features of the language which will most exercise the Java programmer.

Having said all of that, why is it that we cannot be more positive about this book? Partly it's because we have a sneaking suspicion that this book really doesn't go far enough to help the developer making the transition for real. While the book serves well as a rather high-level introduction, it doesn't go deep enough into the practicalities, particularly in that there is no discussion of GUI development, no real over-view of the BCL (Base Class Library - the equivalent to the Java API) etc. Given that a major reason for going to C# from Java is that it gives the developer access to the Windows platform some more detailed coverage would have been very useful.

If the scope of the book had extended just that little bit further then this would have been a much more useful book, as it is it's useful and interesting but it will only take you so far. For Java programmers looking for that quick start, however, it does do a reasonably good job.

Hit the 'back' key in your browser to return to subject index page

Return to home page