Disclaimer: My opinions.

Background

I have been a Java developer for almost 2.5 years now and I don’t hate it by any measure. I think Java is great and has many uses but I have recently switched to C# and found myself enjoying work rather than being agitated with pointless issues that I have faced with Java. I will cover my experience with C# and compare it to Java so far and hopefully open some peoples eyes because I feel that everyone has a closed-minded approach when it comes to anything to do with Microsoft.

Visual Studio is the best IDE ever

Visual Studio has been around for decades now, it has improved in so many ways that I can’t even begin to describe. Let’s start from basic stuff like the fact that it is free. Visual Studio Community is free to use for individual developers, it includes 90% of features that the pro version offers so you can take advantage of numerous features of VS without even purchasing it. The intelliSense in VS is by far the best I’ve ever come across compared to any IDEs that I’ve used like eclipse, Idea and NetBeans. Eclipse is frustrating, Idea is sluggish and takes ages to setup and NetBeans seems to be living under a rock. Visual Studio 2015 which is the version I’ve been using before the newer 2017 release has countless number of features like:

  • Nuget
  • Testing (and now Live testing)
  • Refractor and suggestions
  • intelliSense that isn’t broken
  • Fast - Eclipse is probably the most painfully slow IDE I’ve ever come across
  • Key mappings (the shortcuts, matching and navigation is just amazing)
  • Code peeking
  • Language support (which many many Java IDEs lack)
  • Breakpoints and debugging (No Java IDEs can compare to VS on this point)

The performance comparison between Visual Studio and Eclipse or IntelliJ Idea is just unfair, VS blows all of these IDEs out of the water when it comes to how fast and accurate the intelliSense is, its not comparable by today’s standards.

MSDN is better than Oracle Docs

Need I even go into this? Comparing MSDN to Oracle now makes me feel so happy. I’m developing on a stack and platform where I know I have all the help I need, I find most times that I don’t even need to click on the ever-so-tempting StackOverflow link when I am stuck on what method to use for getting the day part of DateTime. MSDN not only looks nicer, but provides good examples, well documented classes and methods and most of all; it is up to date with all language specifications released.

Judge for yourself: MSDN DateTime vs Oracle docs DateTime

C# does it all better

It is clear that Java and C# are very very similar languages. The OOP specification is similar (though C# is better in that sense too), the layout and style is very similar. But there are numerous features that I have found in C# which give the developer an ease to work with their project than what Java provides.

  • var - My biggest love for the language, equivalently in Java: Type type, where Type can possibly be very long to write out
  • LINQ - LINQ is one of my favourite features of C#. It gives you the ability to write readable and concise code without trying to convert things into stream() and doing backward conversions. It is so easy to use and provides a good performance boost in a lot of cases. Not to mention how optimised it is
  • Properties - No need to write getters and setters (I absolutely despise this about Java foo.setX(foo.getX()+1) compared to foo.x += 1)
  • Extension Methods - Also one of my favourite things
  • Null coalescing operator - foo.y = x ?? -1
  • Null conditional - foo?.y
  • using blocks - Scope a block of code with a using statement which can be so useful
  • async, await, Task - The threading techniques that C# provides are so much more easier to deal with and look at than Java, I am tired of using synchornized
  • Anonymous Types - Very useful to serialising things when you don’t need a Model class
  • No checked exceptions - Thank the lord
  • dynamic - Dangerous but so much more useful that doing reflections the long way

Community

I find that the Java community is mostly littered with inexperienced developers due to the sheer fact that Java is used in almost all universities to teach programming. This is good, but it also means that StackOverflow is just cluttered with questions and queries that are not very helpful. Meanwhile, C# is mostly used in professional environments to tackle more in-depth tasks. Sure this isn’t something that makes Java a lesser language by any means but it contributes heavily to people looking to get into

Lifecycle

It is also quite obvious by now that Oracle have been too busy chasing Google about Java and use of the Java language and libraries and their focus has been shifted away from focusing on making Java better. Oracle and the community have allowed the language to stagnate to a point where comparing it to C# it is painful to use and more time is spent writing System.out.println("testing this feature") than it moving onto newer features. I think this comes down to mostly the IDE aspect of it and the fact that there just aren’t good enough tools for Java development compared to Visual Studio. There is no Java equivalent of Azure or Visual Studio Team Services or CI, because you’re left to do everything by yourself. You’re not one click away from deploying your application unless you spent several hours earlier making bridges and writing scripts for it to be that way. With Java you don’t find yourself in one place, you find yourself in several places at once from making pull requests on Github to checking the build log on TravisCI to checking the deployed web-app that you just fixed on Heroku. As a developer I love that VS offers me everything, I can do almost all of my tasks without even leaving the IDE.

Conclusion

In my opinion and experience, I feel that C# is a language that is worth learning over Java. They are very similar languages and the only downfall of C#.NET and the .NET framework as a whole is the dependency of Windows which I hope Microsoft address in the near future. It is arguably one of the most structured languages and in my opinion also quite strict with a lot of things. It provides the ease of development along with the tools you need as a developer which unfortunately Java just doesn’t provide. The way it is looking right now, a lot of companies are moving away from Java and heading towards other languages such as C#, Python, Go, Scala etc. and the only thing still keeping Java alive is the Android platform; which I believe will also head in a different direction soon enough after the emergence of Swift by Apple.

Leave a Comment