Why I choose Java
As programmers we have a bewildering amount of platforms and languages to choose from. Making such a choice is not always easy, yet it’s quite an important one. Many parts of your application can be refactored later, but language is not something you can (and should) change overnight.
So what are the viable options?
At first it matters to decide on what platform your app is going to run. For an iOS app it’s basicaly Objective-C, with C++ and pure C being options. For Android it’s Java, although with some Google flavors added.
For desktop apps there’s more choice. OS X is Objective-C again, Windows is mostly C#, while Linux favors C. On all those platforms, C++ is an option as well (combined with eg Qt) and surprisingly C# is an option too (via Mono). Java actually runs on the desktop too.
Serverside there’s quite some choice as well. Java is exceptionally strong here and C# is no baby either. C, Objective-C and C++ however are barely options here. There are some other choices here though, like Ruby and PHP.
Since my interest is primarily serverside, I focussed mainly on that area. After careful consideration I choose Java for my next project for the following reasons:
1. Java is on of the most popular programming languages in the world.
This becomes clear when looking at the Tiobe language index, jobs available on indeed. com or questions on stackoverflow. Java is often number one or very high ranked (on SO C# has more questions, but Java follows not far behind). This means there simply are a lot of resources available to the Java programmer. There are many books available, many conferences to go to, many articles to read and many jobs available. RoR may be a nice and influential framework, but Ruby simly doesn’t enjoy the popularity that Java does. Tiobe puts it in the 1% range, while Java sits in the 18% range.
2. Java is one of the fastest languages
The Debian language shootout consistently puts Java in the top tier of most performant languages. C and C++ do outperform it, but not by a very large margin. Dynamic languages like Ruby, PHP and Python perform much, much worse. On some benchmarks this is even 2 orders of magnitude worse.
For web applications it’s often the case that 90% of the time is spend in the database, so Java web applications are certainly not two orders of magnitude faster in general but it does allow web frameworks to do quite some extra work without any significant impact on performance.
3. Simple no-nonsense syntax.
Java has a simple syntax that’s relatively easy to learn. It’s in the C family, so Java knowledge easily transfers to a multitude of other languages. I actually liked C# a bit better here, but Java and C# are still relatively close and Java gets some syntax enhancements real soon (JDK 7, I love try-with-resources) and some more are on the way (JDK 8). The only thing I really disliked about the Java syntax is checked exceptions. It’s a personal thing maybe, but to me both the Ruby and Python syntax just look too weird. I tried them both but me and they just didn’t click.
4. Java is cross-platform
Java is available on many platforms and its binaries work everywhere with the exception of Android, which compiles binaries to another VM format (Dalvik). C# was mainly at a disadvantage here, as it’s very strongly tied to the MS platform. The language is available on Linux, but its ‘native’ library. NET certainly is not (at least not at a level suitable for production).