Why Java? Thursday 1st March
Java is a free and open sourced strongly typed object-oriented language and was released in 1996 by Sun Microsystems. Since I started developing in Java 13 years ago, it has come on leaps and bounds. It is ubiquitous in that most operating systems support it, and it has appeared on almost every mobile handset. You won’t just find it in computing devices, you will find it on smart cards, such as Oyster, Blu-ray discs and there is even a pen that is powered by it.
When people talk about Java’s strengths, they will probably mention first of all the ‘write once run anywhere’ philosophy. In my view, this isn’t Java’s greatest strength, nor is it strictly true. The assumption occurs, because Java is part compiled down to bytecode, which then runs on a JVM, short for Java Virtual Machine. Technically the bytecode should run on any JVM. However, because there are 3 distinct variants of the Java libraries, the code will fail when trying to access libraries from the different variant it was compiled against. Additionally, various companies release their own JVMs, and the bytecode does not always run identically. A classic example is the IBM version, which handles several features, such as generics and autoboxing, in slightly different ways. Even when running against the same variant and JVM on the enterprise version of Java, different application containers have their own ways of setting up and executing the code that is generated.
I have always thought Java has other more significant strengths. Firstly, the number of feature rich, robust open source 3rd party libraries available provide both choice and significantly reduce costs. Secondly, it is simple and hard to get wrong, which means you can quite happily let someone without too much experience develop the more simple areas of the application and know they can’t do much harm, although it is always worth letting someone with experience define the architecture and design of the overall system. Additionally, code reviews are quick, tests are simple and development speed is fast. This is the main reason for being the teaching language of choice for many universities.
So, when is it appropriate to use Java as the language for your application? To answer this question properly, you really need to know what your application is going to do and which platforms you plan to run it on. On the enterprise front, Java is particularly powerful; you will probably find that most of your financial transactions have been processed by an application written in Java. Its enterprise edition was designed to scale easily and efficiently and communicates well with others. There is little reason not to use it within the enterprise, as it is cheaper to run, i.e. you don’t need a licence to run it, it provides hooks to get analytics of its performance and the modularity of the code is easily manageable. If it is a website, many other languages will do what you need, whether it is PHP or ASP.NET, however many of our clients use Java based UI frameworks such as Wicket or PrimeFaces to great success and with the ever increasing number of 3rd party toolkits, development is quicker and cheaper than ever. If you are writing a desktop application, then this is where the ‘write once run anywhere’ philosophy is properly leveraged and actually works. If you were writing for Windows only, then it would be a tossup between .NET and Java. However, you can achieve a decent native look and feel with Java and can be sure it runs on Mac OSX and Linux. Because Android uses the desktop variant of Java, porting a desktop application to the mobile device can be a relatively painless experience. Regarding mobile development, on Android Java is pretty much the only language you should use. On iPhone, it used to be the other way round, and Apple have been very insistent on developers writing in syntactically heavy Objective C, however they have relaxed their rules significantly. In 2011, Oracle showed off a Java application on the iPhone; but, it is still early days to know whether the language will become popular.
When Oracle bought Sun in 2010, Java was going through a midlife crisis, and the time between updates became protracted mostly due to infighting between members of the community. Other languages started catching up and .NET, Java’s main competitor, appeared to have not only gained ground but surpassed it in language features. Oracle has now provided a roadmap with planned releases on a near yearly basis, and plans to reduce the number of variants, and Oracle has already released the 7th version of Java. Java’s number of features is quickly catching up with its competitors and I have every faith that in 15 years, it will still be going strong.
About the Author
Jack Moxley has been developing in Java for the past 13 years. Although Java is his language of choice, he feels he can write this article without bias, as he can develop in more languages than he has fingers.