Once in a great while I stumble across a supposedly “professional” article that makes little to no sense. This is usually due to some over evangelical developer who just loves a language. I think it is part of our job as developers to hold back the love and always approach language comparisons with an open mind. In this entry I will talk about an article that gives 10 reasons why a person should switch from Java to C# and why this type of content gets thrown out into the industry…. right here on the Programming Underground!
So today I stumbled across an article at http://www.c-sharpcorner.com titled “Top 10 Reasons to Switch from Java to Visual C#” by Will Wagers. The link is here if you wish to read it yourself. I will be going through most of the points and give my take on it and why I think he was a little too zealous on the opinions. Before I do I just want to state that I am a Java developer and a C# developer. And while I may bash some of his points on why someone should switch, I do find C# much more to my liking. Ironic huh? But just because I like C# better doesn’t mean that it is necessarily better in all situations.
1. “C Style” memory access – His main point was that Java doesn’t have the ability to handle pointers, and while visual c# does allow the use of old C style pointers and hence direct memory handling, it is the better choice. Fine, great, dandy and it is a true statement. The problem with this is what he says after that about the industry moving away from direct memory management and that even C# forces you to use the “unsafe” keyword. That is absolutely true and hence negates the whole argument of why C# is better than Java. If the industry is trying to get away from direct memory access, then this point (while true) is of little reason to simply switch.
2. Extensions for component-oriented development – This point he states that visual c# has a “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”.
While it is true that Java doesn’t have things like delegates or versioning, it does support a component oriented development style that includes properties, indexers, inheritance and attributes. As for esoteric or rigid naming patterns… C# is case sensitive language and includes namespaces both which enforce a rigid naming pattern to access objects. So I don’t know where in the world he was going with this one.
3. Familiarity – He points out that Java developers will find C# very comfortable. That might be but then again if you have been nothing but a Java developer, the whole idea of the .NET framework can be a bit scary and the idea of events a little awkward. Not saying that a Java developer couldn’t figure it out mind you, but parameters like “sender” and “eventargs” may seem a bit overkill and a little verbose. It might be even easier to go from C# to Java because you will see half of the C# lines can be cut out for a more compact version in Java.
4. Interactive XML Web services – Sure Visual C#, as well as the rest of the .NET framework, makes it very easy to setup and consume web services. After all Microsoft was one of the companies truly pushing this new technology. Remember the UDDI and its supposed “revolutionize the world” technology? As I have stated in other articles, that pretty much fizzled and is now used primarily by large “private” companies. Java can use web services as well and that was part of the reason behind web services, to be universal. A person could write a java app to access a C# developed web service.
8. Target any device – “Visual C# lets developers target desktop computers or a variety of handheld and wireless devices using identical tools and skills. [b]True, but all the devices must be Windows based[/b].” Am I the only one that thinks this last part is the completely opposite of the first part? How can it target any device if the device must support the .NET framework and be windows based? Java is much more cross-platform compatible than C#. So much so that it is the language of choice for cell phone software and PDAs.
9. Visual Studio .NET IDE – Its an IDE for heaven’s sake! Java has a ton of IDEs and a lot of them can do the very things that the Visual studio IDE can do (of course with differences targeting Java development). I am not sure why he includes this as why C# is better than Java and hence a reason to switch to C#. Don’t get me wrong, it is a wonderful environment and I love it, but hardly a reason that would tip me over the edge in jumping ship on Java for C#.
10. XML comments – He states that C# supports XML comments/documentation and then continues by saying so does Java. However C# does it with a little “twist”. Again I am not sure why this would be a top reason to switch languages. It would be different if Java couldn’t do XML comments altogether.
By reading the article you can tell the author is a total C# fan and then to read his small bio at the bottom of the page you can confirm it. If an author is going to enter dangerous waters with a direct comparison between to programming languages, don’t flip flop on the issue and state your case… and be right about it!
My favorite part of the whole article is at the end where he attempts to calm the waters by saying that each language has its own strengths and weaknesses, which is true, but really kills the point of having a “top 10 reasons to switch” article.
As I have always stated to beginners and even experts alike, go with what you know and what will do the best job to solve the problem at hand. One language can’t solve everything. I think we need to stop the language bashing and embrace all the languages. That is why some of the most successful developers are the ones that know 10+ languages.
Thanks for reading! 🙂