17

Today I posted a question asking about which language C# or Java would be better for me to study. I had some great answers. One thing that came up was that perhaps Java is now rather behind C# with new features. I saw some web links and most pointed out what C# had and what java did not have.

So my question to you all is will Java catch up with C# again? And if you were to take a guess where would it stand in 5 years time. Would it have all the things that are maybe now missing? How about Java 7?

4
  • 7
    -1, presumptive and hypothetical. Would change to +1 if title changed to "Is Java behind C#, and if so, how could it catch up?"
    – Nicole
    Mar 31, 2011 at 15:22
  • 2
    Will Java and C# catch up to Scheme? Let me know when you get anonymous first class functions, closures and continuations.
    – snakehiss
    Mar 31, 2011 at 18:25
  • 5
    @dietbuddha: I prefer not littering my code with )'s, thank you very much.
    – Josh K
    Mar 31, 2011 at 18:41
  • 1
    @JoshK you'd rather fill it with ; and }, right? LISP seems to use a lot of parenthesis because every function use them, and you nest a lot of functions in it. Aug 21, 2012 at 14:48

9 Answers 9

32

Language features are very small part of what makes Java and C# tick. Ultimately these are parts of larger J2EE and .NET ecosystems.

Both have their own strengths and should grow bigger in next 5 years.

11
  • 19
    +1 for "Language features are very small part of what makes Java and C# tick"
    – Craige
    Mar 31, 2011 at 14:11
  • 1
    Yes, the APIs and libraries are in many ways much more significant.
    – Michael K
    Mar 31, 2011 at 15:11
  • 2
    Agreed, but the questions is about the language and not the ecosystem ;)
    – Philippe
    Mar 31, 2011 at 15:22
  • 1
    I really hate voting +1 on very short answers, but you are on to something here. Would love to see you expand this answer.
    – Nicole
    Mar 31, 2011 at 15:23
  • 3
    Questions says : "which language C# or Java would be better for me to study" and "where would it stand in 5 years time" both these aspects rely more on ecosystem then language. Mar 31, 2011 at 15:25
16

I would have said yes until Oracle came into the picture. Which is sad, because I really enjoyed the leapfrogging in features Java and C# had for the past six years or so.

6
  • 2
    Why do you think Oracle will sabotage Java?
    – user7007
    Mar 31, 2011 at 15:00
  • 2
    I just don't think the corporate culture there has the same same agility Sun had in incorporating features. Mar 31, 2011 at 15:38
  • 8
    @Glenn, the Oracle vs Google lawsuit shows to me that they don't "get" open source, and that it means large companies are less likely to pick Java for future development. groklaw.net/staticpages/index.php?page=OracleGoogle
    – Tangurena
    Mar 31, 2011 at 16:37
  • Oracle might not exactly "screw Java", but the JVM. Right now they have project to combine two JVM implementations they've acquired JRockit from BEA and HotSpot for Sun. While they're at it, they completely left out Da Vinci Machine project.
    – vartec
    Mar 31, 2011 at 17:19
  • 2
    I'm mixed on Oracle. The Android suit is kind of a turn off, but they contribute to the Linux kernel and they're the primary developers of the Btrfs filesystem. Oracle seems to "get" open source better than Microsoft, but that isn't saying much.
    – jonescb
    Mar 31, 2011 at 18:27
6

As a language, I don't expand Java to add innovation at a significant rate, primarily because those in the open-source community that are on the cutting edge are more likely to focus on the newer JVM languages, such as Scala, Clojure, Groovy, JRuby, and JPython.

Also, Java's commitment to backward-compatibility means that adding language features is inherently harder than in the earlier days of the language.

5

The big question mark here is Oracle. Sun really slowed things down for Java over the past half a decade or so. The hope of many in the Java community was that Sun would spin off Java or sell it to someone who would put lots of resources and effort. While Oracle certainly could do that, it's a large company with lots of groups with their own vested interests. My guess, and it is just that, a guess, is that Oracle will let Java stagnate and use it mainly as a tool for patent lawsuits.

Perhaps they'll sell it off to Google for some large amount of money and everyone will be happy. It's in the hands of boardrooms and lawyers rather than engineers and software designers.

On the good side of things, even without improvements, Java is a good language and has a nice ecosystem around it. While I personally prefer C# and the .net world, Java is still a great choice. Going forward, time will tell but as of now, Java isn't at all bad. (Date and time libraries excluded... wow, are those ever ugly and messy)

2
  • 1
    There are third party libraries now to overcome the date/time issues.
    – Michael K
    Mar 31, 2011 at 15:16
  • 1
    Oracle was using Java along with PL/SQL as a language for programs that lived inside the database, at least as of 10g. Oracle uses Java heavily. Whether this means they'll take Java in a direction I like is questionable, but they aren't going to kill it. Mar 31, 2011 at 15:20
4

There's nothing to catch up with, so the question makes no sense.

Just because Java doesn't exactly replicate C# doesn't mean it's "inferior" in some way, it's just different. Might as well ask when C# will "catch up" with Cobol.

5
  • 23
    I don't agree. C# and Java are similar in many ways, much more than than C# and COBOL. I remember one day reading that "C# is what Java should have been". To sum up, I believe that C# and Java are directly competing, and having worked with both I have to say that I a lot of C# features in Java, but not the other way around...
    – Philippe
    Mar 31, 2011 at 15:16
  • Did you find situations where you could use either C# or Java? I.e. situations where developer could make a choice. Usually a shop would already have preferences / prejudice / bias and choice would between languages on same ecosystem. E.g. between Java and Scala or between C# and F# Mar 31, 2011 at 15:38
  • 2
    I don't agree with all the design decision C# made, but like Java, they consciously set about making a C++ replacement, and with the example of Java before them, they deliberately added some critical features Java left out. So if you think those features are good, then Java has to "catch up" with C# Specifically, the ability to create inline objects so that everything object oriented doesn't HAVE to be bloated, and I think const. Delegates are a new feature they built in, not that they can't be built as a library data structure. I would say they both have to catch up with C++!
    – Dov
    Mar 31, 2011 at 17:25
  • @Philippe, don't get caught up on his counter example. He could have just as easily said "When will C# catch up with Java?". His point still stands that there's no objective reason why Java is behind C#; it's all personal preference.
    – jonescb
    Mar 31, 2011 at 18:25
  • Nobody is talking about replication, but C# has some essential features that Java is just considering implementing NOW (like lambdas, which are emulated with an ugly object implementation). Aug 21, 2012 at 14:51
4

The question of whether C# or Java is ahead of the other is up for debate, but instead of focusing on language features of one or the other I would rather focus on what's involved with evolving a language. The is one fact that I don't think anyone will argue with: Java is older than C#.

Problems with changing how a language works:

  1. If you break backwards compatibility you piss off a lot of developers
  2. If you piss off your developers, they move on to another language that supports them better. Hence, no reason to keep working with the language.
  3. Java made some design decisions early on with a pressure to get the language to market. The hope was to go back and fill in some of the blanks. Those decisions still plague the language because the maintainers don't want to violate the first point.
  4. Java blazed a lot of new territory, and proved once and for all that a garbage collected language can be taken seriously--and perform well enough for most people.
  5. C# came in later and learned a lot of the lessons that Java stumbled into--so they were able to avoid some of the technical limitations that Java has because of point 3.
  6. New language features have to solve a real problem in a sensible way. Not every language feature makes sense in the context of the language you are trying to add it to. This is why, despite their similarities, Java and C# will continue to be different languages.

So, does C# have more language features than Java? I think so. Are they useful? I think so. Does that mean that C# is better or more mature than Java? That I disagree with. They are different, plain and simple. Java will never have all of C#'s features as C# will never have all of Java's features.

One of the features of Java, the ability to write a program on Windows and deploy it on Unix or Mac, will never happen directly by Microsoft's support. Why, you ask? It's not because Microsoft is evil (whether that is true or not I don't really care). It's because they learned a lesson that Sun never did: write once run anywhere commoditizes the operating systems and hardware. If you care about making money from the sales of your operating system, you don't want to make it trivial to swap out and still have an application work. If you did that, you can't make any profit from the operating system because there are always cheaper options.

4
  • Why does it matter that Mono is not run by MS? Mono works really well. Don't underestimate it.
    – Kugel
    Dec 13, 2012 at 16:00
  • It's not a dig on Mono, but not all the .NET APIs are supported directly. While they are making headway, and have come quite a long ways, there are limitations--particularly in desktop applications. Not sure how close Mono has come or if it legally can come to implementing Winforms or WPF. However, for strictly server side work, I'm pretty sure it's compatible. Haven't looked into it recently. Dec 13, 2012 at 16:28
  • I think "the ability to write a program on Windows and deploy it on Unix or Mac, will never happen directly by Microsoft's support" has been disproved now
    – JoelFan
    Nov 27, 2014 at 16:07
  • At the time I wrote the answer, it wasn't. So C# has a Microsoft written a runtime and libraries that work on Mac and Unix? Mono isn't directly from Microsoft, even though it might have some Microsoft developers working on it. I still have doubts about a desktop app built on WPF working for Linux. Server side only might be OK. Nov 30, 2014 at 17:21
1

Java really doesn't need new "features" any more than C or C++ does. It is a well designed language for object oriented development. The additions that may be made are in creating libraries for performing a wide range of tasks. The same goes for C# - most of the features are being added to make the language do more things. Personally I think most of those features aren't necessary - pointers in OO really are so much fluff unless you're working at the hardware level (at which point it's probably better to use something like C). Besides, running in a VM is supposed to make directly accessing the hardware difficult, if not impossible.

Unix started the trend of creating modules that do one thing very well. I think that both Java and C# are getting a little out of hand on feature creep. It's better to create an easily extensible core than a giant multipurpose "language" which is more like a framework. To me, Java fits this requirement better than C#.

8
  • 7
    Language without proper lambda is not a usable language. If that one feature is added to Java, I'd agree with the rest of your arguments. Without that, Java is not extensible at all, it is barely usable.
    – SK-logic
    Mar 31, 2011 at 15:30
  • 2
    @Craige Personally (opinion) I don't like having sytactical features. I want the language to be out of my way - very minimal.
    – Michael K
    Mar 31, 2011 at 15:42
  • 1
    @Michael - I fail to draw the connection between a a language having syntactical features and a language that gets in your way. Just because a language has said features, doesn't mean you have to utilize them. Take C#'s getter and setter methods for instance. 90% of the time, that will save you writing hundreds of lines of redundant code. You can still write your own if you wish, though.
    – Craige
    Mar 31, 2011 at 15:45
  • 1
    @Craige, if language have features, your tools have to know about them, at least. And the power of the Java ecosystem is primarily in its tools, which are possible entirely because of the language minimalistic simplicity.
    – SK-logic
    Mar 31, 2011 at 17:40
  • 1
    @SK, I don't understand how you can say that a language with lambda's in unusable. C doesn't have lambdas, and C++ gets them in C++0x and people have been using these languages for decades. Just because you prefer functional programming that doesn't invalidate imperitive programming.
    – jonescb
    Mar 31, 2011 at 18:34
1

There's nothing wrong with many of the features that C# is adding, but given the rate at which they are changing the language, they are consciously making it difficult if not impossible for Mono to keep up. If so, then I say that we are waiting for C# to catch up to Java in terms of the range of systems it can deploy to. It's not sufficient to just run on Windows.

0

I'm not going to start a discussion forum, but I think that Java was here long before C# and for that matter C# seems more like a replication then java.

As for answareing your question: Java and C# are different languages therefore you can not compare them only by their features. What you can do in Java you may can not in C# and vica versa.

So finally this is like starting a Windows vs Linux topic.

Not the answer you're looking for? Browse other questions tagged or ask your own question.