As the old joke goes, "Why do Java developers wear glasses?... Because they don't C#." We take a look at some signs that C#'s star may be on the rise...
Java has been a mainstay of the programming world for over 25 years, originating back in 1995. It is used on severs, mobile phones and desktops world-wide. Many, many applications rely on Java for their very existence. However, recently the TIOBE index
indicated that C# is challenging Java for popularity and may well be about to overtake it.
In this blog we will example TIOBE’s claim and compare it to the results seen in other indexes and survey web sites.
Java and C# have a lot of History!
There is a long history between C# and Java going back to the late 1990s. This history is fraught with tension between the owners of Java (previously Sun and now Oracle) and Microsoft.
Back in the late 1990s, Sun Microsystems, who created Java in the first place, were attempting to provide a more managed way of ensuring that all versions of Java were compliant with the Java standard. Microsoft, which at the time had readily adopted Java as a language for their .NET platform, initially stayed in line with this standard. Issues arose around the fact that Sun was a traditionally Unix-based hardware vendor while Microsoft was a PC-based Operating System vendor. These two differing positions meant that each believed they were following the right path for their version of the language, but those paths were bound to diverge.
Microsoft took a somewhat confrontational approach, choosing to modify some of the methods within the main Java definitions. This means that code written for Sun’s version of Java could not be directly / easily run on the Microsoft version. This of course broke Sun’s vision of a language which was “write once, run anywhere’. Of course, from Microsoft’s point of view, they wanted a language which would run efficiently and effectively on the Windows operating system, on whatever machine it happened to be running on.
The result was that Sun decided to sue Microsoft for breach of contract stating that Microsoft was not following the Java standard and therefore could not call their language Java. In term Microsoft claimed that Sun was being anticompetitive by restricting the use of Java such that it was focussed on the Unix world. These court cases would drag on for years before they were resolved.
In the meantime, Microsoft decided that they would freeze their development of Java back in Java 1.1 which was a version which did not have the same constraints as Java 2 had in terms of licensing.
However, they had learnt a lot about creating a modern Object-Oriented Language for use on their .NET environment. They therefore used this experience and created their own custom language which was tuned to the .NET environment; this language was C#.
Microsoft introduced C#
In many ways C# was Java for .NET; many of the same ideas were present in Java, were present in C#. It was object oriented, it used very similar syntax, it has similar libraries (although names were changed to protect the innocent). It wasn’t an exact copy there were some additional concepts such as properties and some additional flexibility in the way that a class was defined etc. but on the whole the two languages were (and still are) very similar.
This means that it is quiet straight forward for a Java programmer to move over to C# and for a C# programmer to move over to Java. Of course, the frameworks and libraries they use are quite different, for example it is common to use the Spring framework with Java while of course C# builds upon the .NET framework.
The popularity of Java and C#
In the past, Java was by some margin the more popular of these languages. It often came 1st or 2nd in any survey of the most popular, most used or most sought-after languages. C# was hardly ignored but it often came 4th or 5th in any of these surveys.
Has interest in Java fallen?
So what has been happening to Java over the last few years? Well, there has certainly been a decline in its position on these indexes and rankings sites. Back in the late noughties it was almost always number 1 and that just isn’t the case anymore. However, does that mean that interest in Java has gone away – well let’s look at a few points made by some of these index sites and the consider the overall trend.
The TIOBE Index
For anyone who follows these blogs you will know that we also look at the TIOBE index. This index is a rather wide-ranging index that takes into account a number of factors, as they say on their web site:
“The TIOBE Programming Community index is an indicator of the popularity of programming languages. The index is updated once a month. The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. Popular search engines such as Google, Bing, Yahoo!, Wikipedia, Amazon, YouTube and Baidu are used to calculate the ratings. It is important to note that the TIOBE index is not about the best programming language or the language in which most lines of code have been written.”
So, it is not just about searches on StackOverflow, or the number of jobs being advertised or the amount of code in GitHub etc. It tries to be an overarching index.
On the November TIOBE index Python is again number 1 with C 2nd and C++ third. On this index Java is 4th and C# is 5th. The interesting thing is the change on twelve months ago, Java has dropped 3.92% in terms of its share of the index and C# has grown by 3.29%. This is not a one-month anomaly, according to TIOBE this reflects a general trend away from Java and to C#.
Why does TIOBE think interest is falling in Java?
TIOBE believe that there are several reasons for this including the relatively slow rate of development of the Java language which has led to interest in Kotlin, which some people describe as a better more modern, Java. It is certainly true that Kotlin is a language which is compiled to the same runtime environment as Java and is interoperable with Java allowing developers to take advantage of all the Java libraries available. It is also true that Android now states that Kotlin is its preferred implementation language (rather than the previous Java). However, on the TIOBE index Kotlin comes in at 18 with a very small 0.53% increase in interest on twelve months ago.
Another reason TIOBE thinks that interest in Java is waning is due to licensing rules. Oracle has introduced a paid license model from Java 8 onwards. In contrast Microsoft has taken the opposite approach with C# (which previously could only be used with the commercial Microsoft Visual Studio toolset). C# is now free and open source and although most developers use it on the .NET Microsoft Windows platform there is a version available for Linux.
However, there is also a version of Java called OpenJDK which is also open source and 100% free – although Oracle don't advertise that fact, most developers will be aware of the alternative. Note that OpenJDK is an official reference implementation of the Java Standard Edition, so this is not some fly by night implementation. It is managed by the Java Project which involves Oracle themselves, Red Hat, IBM etc. Interestingly Oracles version of Java is built on top of the OpenJDK version. Both have a six-month release cycle but OpenJDK only guarantee to support a version of the JDK until the next version is released.
The main difference between the OpenJDK implementation and the Oracle implementation is that the Oracle version has a few additional features such as Flight Recorder, Java Mission Control and Application Class-Data Sharing features. None of which are essential to Java development.
To conclude this section, TIOBE expect C# to overtake Java on its index within the next few months.
Is TIOBE right about Java?
To answer this question let us look to see if this trend repeated on other indexes? And in particular, how does Java compare to C# on other indexes?
Let us go back to some of the indexes mentioned earlier, if we look at PYPL then Java is actually section in the PopularitY of Programming Languages index with on a tiny -0.8% change over twelve months ago. In contrast C# is down in 5th having dropped a place (with a fall of -0.3%) on a year ago with C/C≠≠ over taking it. In turn on the TechRepublic list of Top 10 programming languages employers want in 2023 Java actually 3 (although it was 1st in 2022) and C# is down in 8th
(having dropped from 6th). On the Berkley index Java is fifth and C# is down in 8th. On StackOverflows
own survey results Java is 7th and C# 8th on the 2023 Programming, scripting and markup languages. In 2022 Java was 6th
and C# was also 8th. So very little change there. Finally, on the Statista site on the 2022 survey Java was in 5th position and C# in 9th
position (with half the level of interest compared with Java) whereas in the 2023 survey Java 7th with C# 8th.
In fact, the DistantJob
site, has compiled a top 5 index that lists the results from 6 different indexes including GitHub and IEEE Spectrum. On this Java comes in second or third on all the indexes whereas C# isn't even listed on half of them.
Why does the TIOBE index differ from other Indexes?
So why is the TIOBE index out of line with other indexes or surveys? Possibly because it does cast its net wide and considers a wide range of inputs including things like courses and online training. One feature of Java is that it is widely taught at University level and therefore demand for such training courses may be less. Of course, a similar argument could be made for C# but less undergraduate courses have such a focus as those using Java. It could also be that many people already in the industry know Java well whereas for some other languages it may be necessary to reskill. Again, a similar argument could be made for C#.
Another possibility is that some of these indexes or surveys only happen once a year and they may thus miss month on month trends whereas the TIOBE index is updated each month. However, this is also true of the PYPL index which has Java solidly in the number two spot with almost three times the amount of share of the index as C#.
Another point to note is that from java’s point of view, TIOBE is in line with other indexes and web sites, Java is falling down the rankings, albeit very slowly and it will probably not fall far. However, in those other rankings C# is also either falling or steadfastly remaining where it is – currently below Java. It is therefore quite possible that TIOBE has picked on a trend for Java but that for C#, on its index, it is out of line with the other indexes – we shall have to wait and see.
Looking at any of these indexes it is important to take a high-level view and consider multiple examples to get a general trend – if there is on its that both C# and Java will be around for a long time to come and that there is still huge amounts of interest in both languages.