"Prepare to be assimilated.... Resistance is futile."
- Borg, "Q, Who?", Startrek: The Next Generation
Why should a Java developer switch to C#? Here are the major reasons in alphabetical order:
1. "C Style" memory access
Rather than forcing developers to write code to access application programming interfaces (APIs) in other languages in order to access specific memory locations (e.g. hardware-mapped memory), C# allows developers to use "C style" memory management and pointers when necessary. Of course, one of the major design goals of the Java language and other object-oriented languages is specifically to outlaw such access. A fact which Microsoft acknowledges by forcing the C# programmer to label such accesses with the unsafe keyword.
2. Extensions for component-oriented development
Visual C# provides developers with a powerful component-oriented development language that includes support for properties, indexers, delegates, inheritance, versioning, and attributes, without the need for esoteric or rigid naming patterns and companion classes.
Java developers will immediately find Visual C# to be familiar and comfortable. C# is like Java on steroids. There are some extra keywords; and, Visual C# supports some extra constructs. But, a Java coder can learn the C# language in a day or two. Learning the APIs is a different matter.
4. Interactive XML Web services
Visual C# allows developers to deploy and consume rich, interactive XML Web services that reduce development time by enabling software aggregation from any platform. Microsoft is famous for hiding the details from the developer: This is both good and bad. New developers may not actually know or understand what is going on under the hood. On the other hand, it does increase productivity. Of course, Java developers have a variety of IDEs such as Eclipse to choose from. All of which provide some degree of support for Web services.
5. Leverage the .NET Framework
Visual C# provides developers with access to the Microsoft .NET Framework--a robust, thread-safe library of collection classes, data access classes, networking functions, etc. Recently, however, various bridge software offer .NET access from Java programs as well as access to the rich Java libraries from .NET languages.
6. Object-based type system
Visual C# provides developers an object-based type system that eliminates the need for complex, verbose data marshalling code commonly required by Java applications.
7. Standards-based language
Visual C# provides developers with a standards-based language (ECMA) with all its advantages. This is a significant advantage over the Java language.
8. Target any device
Visual C# lets developers target desktop computers or a variety of handheld and wireless devices using identical tools and skills. True, but all the devices must be Windows based.
9. Visual Studio .NET IDE
Visual C# provides developers with the Visual Studio .NET integrated development environment (IDE) which includes support for task lists, property editors, Microsoft IntelliSenseÂ®, Forms designers, etc. For development on Windows platform, Visual Studio is king. However, Visual Studio lags Eclipse and other IDEs except in Microsoft-specific features.
10. XML comments
Visual C# allows developers to use eXtensible Markup Language (XML) Comments to provide useful and customizable source code documentation. Of course, so does Java although Microsoft does add its own twists to it.
A form of this top 10 list originated with Microsoft. But, because both Java software and Visual C# evolve competitively, non-Microsoft oriented features tend to be matched by each competitor in turn. There is no real reason to use Visual C# instead of Java in general; because, each has its own advantages and disadvantages which may or may not be important in specific situations. Unless you work in a Microsoft-only shop, the requirements of the project should dictate both the language and other software employed.
"Ducunt volentem fata, nolentem trahunt." - Seneca