A Discussion on Programming Languages: Java

posted by on 31st May 2013, at 10:01pm

Back in January I wrote a rather gripping piece on programming languages. I felt as though it could have been more thorough in regards to the specific languages mentioned. This month we’re going to have a look at one of the desktop programming languages mentioned in January: Java. In January I gave a brief rundown of these types of languages and gave some general insight into how they work and what they’re used for. This month I want to talk about the benefits and drawbacks of Java, highlight where it’s used, and of course explain how the language works at a high level.

Before I begin it’s worthwhile to discuss the difference once more between a high level programming language and a low level programming language. High level programming languages are designed with convenience in mind, allowing the programmer to create software more easily without having to worry about the tiny details. Lower level programming languages require the programmer to create more of the footings required. As an example to illustrate this, in a high level language creating a connection to a server is easier than creating a connection in a low level language. This is true because in the lower level language it’s very possible that you, the programmer, would be responsible for actually creating the connection by creating the socket and requesting allocation of system resources.

Java: The High Level Language We All Know

Java is the language that we all know, it’s powered RuneScape for the last decade. Java itself emerged in 1995 as one of the first object oriented languages to gain traction. It is this object oriented nature that allows for a high level of abstraction. This level of abstraction is used in creating many of the features that makes Java a useful language for the reasons outlined below. With such a high level language there are huge benefits and some drawbacks as well that deserve to be discussed. But first, let’s learn how Java works on our system!

Java is a compiled language meaning that developers write code that is readable in human form and then an intermediary piece of software converts this code into something else, byte code. This byte code is code that is transferable to any device that runs Java. You might be thinking, how does that work? It works because this byte code is run by a variety of virtual machines each tuned for the specific device that Java has been designed to run on. As an example the byte code that is downloaded when the Java version of RuneScape is loaded is portable to all devices. This byte code then gets sent to the instance of the Java virtual machine that is running on your system. This virtual machine then does the most of the heavy lifting in interacting with your hardware. After this all happens we get the result of the application loading on our computer screens running based off of the compiled byte code.

The Benefits of Java

One of the greatest benefits of Java is the object oriented nature of the language. Object oriented programming is as simple as it sounds. When programming, the programmer creates objects representing tasks in their application. This allows the programmer to create abstract models of their application therein separating the different functional components. This then results in components that are tailored specifically to certain operations. This is a tremendous benefit since it allows for the easy updating of functionality at later stages in the development cycle. Object oriented programming also has the benefit of reducing the actual amount of code that needs to be written since objects can inherit all of the characteristics of their parents if the programmer chooses. In a trivial example we could have a class that describes a quadruped and then as subclasses of our class we could have children classes called cat and dog that inherit from the quadruped class.

Another benefit of Java is that it is a strict language. The first example of this is that Java requires its variables to be of specific types. This is true for most of the languages that will be discussed today but for Java it’s just the tip of the iceberg. Java also has many built in classes that throw exceptions. Exceptions are errors that are expected to be handled by the programmer. Exceptions are not just thrown but will cause the compiler to throw an error if the exception is not handled. An example of where an exception might occur could be where a file operation has failed or has not completed correctly. The programmer is expected to handle these exceptions correctly and clean up any mess that occurs. In a lower level language the actual error checking itself would need to be done by the programmer. This combined with Java’s generally more strict nature makes it a great starting language for beginner programmers in that they don’t need to worry about inadvertently causing a large system error.

Finally a tremendous benefit of programming with Java is that it will run almost anywhere that a Java virtual machine is employed. Java runs fine on desktop computers whether it be on Mac OS, Linux, or Windows. Java also runs on many embedded devices including older handheld phones. When programming with Java irregularities based on the operating system are very rare unless dealing with deeply integrated systems such as video drivers.

While Java seems as though it’s one of the near perfect languages there are of course downsides to it as well. Most of these downsides don’t manifest themselves immediately since they’re usually only encountered in advanced Java programming.

The Downsides of Java

One of the potential downsides to Java as a language is that it can be very daunting for a first time programmer. A student must first understand the syntax behind the language. This on its own might require some work since Java’s syntax isn’t as clear as something like Ruby on Rails. They must then learn the process to convert the algorithm into actual code. After this then comes learning all about object oriented procedures and practices. This is often considered the daunting procedure in itself since it requires thinking in a different way about programming.

Back in the early days of Java as a language used in desktop applications it was always a concern that it was slower than alternatives. This is still true today but not to the degree that it once was. Java is certainly fast enough for any games or simulations that would be created while learning to program. Because of this Java is often not used in compute intensive applications or tasks where low level system access is required (exception: RuneScape). As a result of this, Java is best used in academic situations or where a device requires it (i.e. Android).

Another downside of Java is that programmers are constantly dealing with a platform that is under attack. Java developers risk their users becoming fed up with the amount of attention it is now requiring to keep a Java install up to date and free of security problems. The main cause of concern for Java is that the full Java language can be used in the web browser with the Java applet plugin, this has become the vector for many security attacks this year. Developers also need to ensure that their software is not causing erroneous security prompts in the end users web browser if an applet is being used.

With these downsides in the Java language it’s amazing at the sheer number of places that Java is in use. In the early 2000s my first mobile phone used a version of Java to run the primitive applications that shipped with the phone. Starting in 2001 Jagex released RuneScape running on a Java browser applet; we all know where that’s gone! Java became the go to language for beginner academic computer science in most universities. Java has also been elevated to the high position of being the language used for Android development, the number of Android applications appearing each day continues to rise. Java is no doubt a popular language.

If you have any questions feel free to send me a private message on the forums or post in the discussion topic.

This article is filed under Tech. You can follow any responses to this entry through the RSS 2.0 feed. You can discuss this article on our forums.