
Java has been the dominant language for a long time. The thing that made Java so popular is that it can run anywhere.
At my last job my team maintained a Java application. Because Windows dominates the user desktop in the corporate world, we developed that application in our Windows machines but deployed it to Unix servers (Solaris). We essentially wrote the application once and if it worked in our machines we knew it would work on the Unix servers (except for those pesky works on my machine errors that are common even within the same OS).
That’s the beauty of Java. It runs anywhere or “everywhere” as Oracle likes to promote. If you have ever run the Java’s JDK installation, you may have noticed their advertisement “Java Runs on 3 Billion Devices”.
The reason that Java programs runs on so many devices is because Java runtime can run on any operating system and, by today’s standards, it doesn’t require much space (123MB). That could be a lot for some firmware but it really is not that high of a requirement.
The way Java works is that a program gets compiled to a class or jar files. These files are binary but they are not in and of themselves directly executable. They must be run by the Java Virtual Machine. The JVM, sometimes called the Java Runtime, is a program that knows how to execute the binary files.
From early on Sun (the former owner of Java) wrote the JVM (or several versions of the JVM) to target different platforms. As long as there is a JVM for the host operating system, a Java program can run.
Java got an early start on being able to target multiple operating systems. That was very appealing to software developers because they could target multiple platforms or operating systems. There is a lot of flexibility when a program can run on different operating systems. It provides the developer with more options.
If you know anything about the software development, you know that the software code is a heavy investment and you can’t just port your code over from one language to another, or even adapting it from one OS to another within the same language (C++). Doing so comes at a very high price.
Java programs are written once and run on different operating systems. This also made it possible to target different types of devices. Because Java was a pretty advanced language, it made the coding process much easier and thus faster.
Java was like C++ but debatably easier to code in. Java offered many things that C++ lacked (e.g. automatic garbage collection, elimination of header files, out of the box libraries for just about anything, better security).
Another appeal to Java is that since it can run on anywhere it can run on free operating systems like Linux. It can also take advantage of open source solutions like Apache and Tomcat. This capability meant that organizations could leverage this advantage to lower their operating costs. Running on free operating is cheaper than paying the MS Windows licenses.
Microsoft introduced .Net Framework around 2003. With it, it introduced C# and VB.net. I think VB.net was to lure the many developers that were already developing in VB, since VB.net has a very similar syntax. C# was another C family language (resembled Java quite a bit). For C++ programmers it was an easy transition to C#. The introduction of these two languages made it very easy to bring over the many VB and C++ developers that were prevalent at the time (I don’t think it targeted the Java people yet, well maybe a little with their J# language).
When the .Net framework was first introduced, the big selling point was that it was language independent. You could develop in any language of your choice from C#, VB or COBOL.net as long as the code compiled to the intermediate language (As a disclaimer I don’t know if there ever was a COBOL.net language). This approach meant that you could write some code in one language and other code in a different language (as separate projects creating separate DLLs or Exes) and in the end they both produced a binary that was understood by the CLR. The best part about it is that these binaries could communicate and understand each other.
I think this selling point kind of confused people a bit. Why did we need something that could allow the creating of different languages? But now that I think about it, it was in many ways like Java because the code compiled to an intermediate language. The real reason was that Microsoft had a brand new product and it created a bridge for developers from all languages to make the transition(C, C++, VB, COBOL) into this new .Net thing.
As time went on the .Net framework along with C# got better with each version. Java has gotten somewhat better and has many of the same features but they are usually a version or two or three behind. In my opinion, initially C# stole many ideas from Java, at least the good parts, but then it eventually surpassed it.
C# has many features that make it easier to code in than Java. The languages are very similar but certain things about Java will drive a developer crazy (look up getters and setters compared to properties and also checked exceptions). Also, C# has a history of introducing new features while Java will eventually introduce them some time later. Microsoft also has a way of great marketing to introduce each version.
I found the C# community more involved that the Java community; more blogs, more how to’s, more videos. I developed in C# for many years and then switched to a Java for about 5 years and I found it troubling at how hard it was to find helpful information outside of the official Java documentation. If you’ve ever read the official Java documentation you know that it leaves a lot to be desired.
I think initially Microsoft’s approach was to keep .Net and C# proprietary and their approach was for it to only support their licensing efforts, but they have, in recent years, changed their position by embracing open source and allowing their flagship products to run outside of Microsoft environments.
Microsoft introduced .Net core a couple of years ago and they have made great strides since. .Net core is a version of .Net written from the ground up that runs on most operating systems (Linux, MacOS, Windows). This is a big step from the old .Net that only ran on Microsoft Operating Systems.
Up until today .Net core was great for creating web application and web APIs. However, it did not allow you to develop Windows Forms or WPF applications. Today (September 23, 2019) during the Dot Net Conference, Microsoft announced support for Windows Forms and WPF.
That’s pretty exciting because that means that programmers will be able to create Windows Forms and WPF applications in and for any operating system. If this means what I think it means, Java now has a true competitor.
I say that as if it wasn’t already a competitor, with just the web alone. It has been a competitor, specially since the web is where the majority of applications are. However, by also entering the desktop application space there is little if any gap left unfilled.
To me it seems that soon there will be little difference between what Java is capable of and what C# is capable of, except that C# is a much nicer language than Java in many ways.
I don’t think this means the end of Java but it could be the beginning of the end. At a minimum it could mean a very heavy loss of market share.
After all, Microsoft is a master at creating awesome tools. They are great at pushing their products. They are good at updating their systems. Most of all, they excel at making developers life easier.
What do you think? Will C# take over Java’s Reign?
P.S. I can’t forget to mention that Java is also a multi-language (e.g. Kotlin), so… only time will tell which language dominates the developer world.
For me it is a matter of preference. I am not a developer per say. I write selenium automation scripts. I have done in C# and Java and I prefer Java for what I do. And running Visual Studio for automation testing I just didn’t like it eats up too much space for me. I prefer using Eclipse and Java for what I do.
LikeLiked by 1 person
Right. Right tool for the right Job. But you don’t need Visual Studio for developing .net core. All you need is VS Code and it’s extremely lightweight.
LikeLike
But for what it’s worth it may take a while before C# can do better than Java in situations like yours, if ever.
LikeLike
Good post Fernando Really enjoyed it! :slightly_smiling_face: . I went from ColdFusion -> Java -> C# (around 2004). I hated the Java ecosystem and tech stack….JavaServer Pages anyone …Struts framework? yuk! I found C# to be a much better put together language and .NET a better framework. .Net Core is a good move, however these days it’s hard to beat Nodejs which can run on anything and allows the developer to use a single language for both client and server…shoot…need a desktop app that is cross platform? Write it in Nodejs and use Electron!
I had curated a list of companies a year or so ago that abandoned C# for Node and Java for Node…was quite the list.
LikeLike
Thanks for your input. You may be on to something. I didn’t consider electron as I wrote this so… it would be more feasible to use web technologies than WPF or WinForms. All paths leading web technologies.
LikeLike