home
Guest Signup/Login to unlock all features

Menu

Views: 762

Replies: 0

Share this post
facebook twitter gplus

avatar

Member

AkGhost

Is C# superior to Java as a programming language?

Feb 01 2017 at 06:15pm

It’s not even close. C# is years ahead of Java.

Consider type inference alone: The ability to write code this concisely, especially when dealing with nested generic types makes a huge difference in one’s happiness when coding. Who the heck wants to repeat things over and over again ad nauseum.

Consider C#’s massively superior support for generics and contrast it to Java’s poor-man’s faking of the feature. This feature alone not only increases developer happiness but also eliminates a whole class of exceptions.

Consider as well C#’s yield operator, which allows for some really beautiful, scalable, implicit stream style coding.

Add to this the support for lambda expressions on C#’s core collection types and contrast this with Java, which makes you switch to other collection libraries or to streams.

And that doesn’t even touch on the massive beauty of LINQ which takes the above functional patterns to an entirely new level by combining lambdas, extension methods , query comprehensions, and more to provide an extraordinarily elegant way to code queries/transformations of both streams and data structures, with predicate pushdown, against any data source.

And let’s not forget dynamic classes in C# which provides us with an awesomely cool way of dealing with things like JSON, XML, and integrating with scripting environments!

And I still haven’t touched on PLINQ, async/await, assembly level visibility, friend assemblies, superior dependency management, the massively sophisticated and productive visual studio environment, accessor/mutator properties, primary constructors, caller information, Roslyn, null coalescing, default parameter values, named parameters……

Obviously anyone who thinks these two languages are similar doesn’t know C#.

As a side note, as time goes by I see C# both innovating and adopting features from Scala, e.g. primary constructors. So if you’d like some exposure to the future of C#, you could do worse than switching to Scala. You’ll have to suffer Scala’s many quirks, but you’ll at least be programming in something that feels like a modern programming language, which Java, sadly, no longer does. Thanks, Oracle.



Quick reply


+ files BBCode

Sponsored