Subscribe to Martyr2's Programming Underground        RSS Feed
-----

10 Reasons to switch from Java to C#? HA!

Icon 8 Comments
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!

<Mr Rogers meets a sledge hammer, poor trolley>

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. True, but all the devices must be Windows based." 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! :)

If you want more blog entries like this, check out the official blog over on The Coders Lexicon. There you will find more code, more guides and more resources for programmers of all skill levels!

8 Comments On This Entry

Page 1 of 1

cbang 

26 June 2008 - 09:48 AM
Nice walkthrough. However...

2) I disagree with you when you say Java includes properties. When viewed inside an IDE's property inspector it may look like a property, but it's a set and a get (or is if boolean) method. Since properties do not exist as a first-class construct, you will notice how we in Java always have to use reflection (loss of type safety) to access these (take a look at JSR-295 or 296). Also it is a major hurdle for the possibility of implementing LINQ in Java.

3) Are you kidding? For a long time Sun bashed delegates (http://java.sun.com/docs/white/delegates.html), yet now funny enough they are actually adding them through closures. In Java it is tremendously terse to work with inner anonymous classes. Notice how NetBeans (Matisse) has to lock a lot of lines of code to make sure NetBeans can make sense of all the indirection, whereas this is not necessary in Visual Studio. Also, delegates is a nice consistent way to implement single and multicast observables, where as in Java you have to deal with java.util.Observable or create your own callbacks which means you have to think about how to arrange them in an interface and very often need adapters etc. etc. (take a look at AWT).

9) Which Java IDE's support edit-n-continue or stepping backwards during a debug session?

So in general, there's no doubt that C# as a language is far more consistent, coherent and productive. The only thing I find superior in Java is the Enum and of course that you (for the most part) get platform freedom.
0

WolfCoder 

26 June 2008 - 11:53 AM
I would find your statements much more reasonable (and a little less fanboyish) if your screen name wasn't "cbang".
0

cbang 

26 June 2008 - 12:12 PM

WolfCoder, on 26 Jun, 2008 - 11:53 AM, said:

I would find your statements much more reasonable (and a little less fanboyish) if your screen name wasn't "cbang".


My nick name is shorthand for my real name (Casper Bang) and I'm a full time Java developer. Could you perhaps focus on the content rather than making fanboy accusations? I'd love to hear what you find inaccurate or unreasonable but you chose to imagine things in your head instead. :v:
0

Martyr2 

26 June 2008 - 07:18 PM

cbang, on 26 Jun, 2008 - 09:48 AM, said:

Nice walkthrough. However...

2) I disagree with you when you say Java includes properties. When viewed inside an IDE's property inspector it may look like a property, but it's a set and a get (or is if boolean) method. Since properties do not exist as a first-class construct, you will notice how we in Java always have to use reflection (loss of type safety) to access these (take a look at JSR-295 or 296). Also it is a major hurdle for the possibility of implementing LINQ in Java.

3) Are you kidding? For a long time Sun bashed delegates (http://java.sun.com/docs/white/delegates.html), yet now funny enough they are actually adding them through closures. In Java it is tremendously terse to work with inner anonymous classes. Notice how NetBeans (Matisse) has to lock a lot of lines of code to make sure NetBeans can make sense of all the indirection, whereas this is not necessary in Visual Studio. Also, delegates is a nice consistent way to implement single and multicast observables, where as in Java you have to deal with java.util.Observable or create your own callbacks which means you have to think about how to arrange them in an interface and very often need adapters etc. etc. (take a look at AWT).

9) Which Java IDE's support edit-n-continue or stepping backwards during a debug session?

So in general, there's no doubt that C# as a language is far more consistent, coherent and productive. The only thing I find superior in Java is the Enum and of course that you (for the most part) get platform freedom.


C# also implements properties via set and get methods. You still have to write these methods to declare a property in C#.

As for the delegates, you are absolutely right about them doing an about face on their position and disguising it as closures. Closures are essentially anonymous delegates. However there is a slight difference between the way C# and Java implement them... not to mention closures are just now coming into Java come JDK 7. Either way this just means more of a reason NOT to switch. C# has delegates and soon will Java. Now again, don't get me wrong, I find C# to be very consistent and it should be.. it was developed from the ground up and Java is still carrying baggage from old implementations.

As for edit-n-continue it is called "hot swap" debugging in Java. It isn't a terribly popular feature for many of the popular IDEs, but it has been around awhile and some debuggers have it like JDeveloper 10g. But I think I failed to make the point, the IDE is not the language. My argument was that the programs used to write code should not be an argument to make a switch between the languages. Someone can come along and develop a fantastic GUI that sits on top of Java and make it do all kinds of tricks, doesn't mean that that it speaks to the language or its syntax. If that was the case, Java might even blow C# out of the water because it has a ton of IDEs that all do different things as opposed to a mere handful for C#.

But with that all aside the whole point of the blog was that we all should step back, analyze what we need for a problem, and apply the best solution whatever that may be. Not throw out articles that essentially say "C# > *" or "Java > *".

Thanks for the input! :D
0

tieTYT 

27 June 2008 - 01:00 AM
9) I'll never understand why .NET developers love VS.NET. Seriously, what makes it great? What even makes it good? I'm convinced that the people who say this either 1) have never used an IDE before or 2) Are simply more familiar with it and are reacting negatively to having to relearn something when they tried another one.

So please, explain to me why VS.NET is better than any Java IDE. When I compare it to Eclipse or Intellij, it seems very basic and featureless.
0

Martyr2 

27 June 2008 - 09:40 PM
Well VS.NET is REALLY feature filled actually and even intermediate users would only tap about 20-30% of the entire IDE. But as stated earlier it has advantages and disadvantages compared to Java IDEs. Again these are simply programs for assisting developers in developing and speaks little to the actual languages.

:)
0

WolfCoder 

29 June 2008 - 01:16 AM

cbang, on 26 Jun, 2008 - 01:12 PM, said:

WolfCoder, on 26 Jun, 2008 - 11:53 AM, said:

I would find your statements much more reasonable (and a little less fanboyish) if your screen name wasn't "cbang".


... rather than making fanboy accusations? I'd love to hear what you find inaccurate or unreasonable but you chose to imagine things in your head instead.


You're a fanboy until you can criticize C# as much as you can praise it. You can ask me the same thing for any language I know and I can sound like I love and hate the language. To be able to criticize something you think is a very good language very much will show that your choice in using it is much more intelligible.

You might find me hating JAVA and loving C++ but I can write good things I personally find and bad things I personally find in either language- the better I can do this will show my skill in choosing the right language for the job. How well can I do this? Well, I'm not very sure but I can assure you a good programmer can murder and love any useful language.
0

ZachR 

30 June 2008 - 05:48 PM
All I have to say, Is that I would choose C# over Java any day!! C# ftw! :D
0
Page 1 of 1

January 2022

S M T W T F S
      1
2345678
9101112131415
161718192021 22
23242526272829
3031     

Recent Entries

Recent Comments

Search My Blog

24 user(s) viewing

24 Guests
0 member(s)
0 anonymous member(s)