Features of Java and White Paper Buzzwords

Features or the benefits are what make a product successful. In the previous article, we examined the history of Java. Almost from its 1.0 release in 1996 Java has been immensely popular. There are literally hundreds of programming languages out there. Some of these such as Python are general purpose. Others such as cater to a certain niche. And still in this myriad of mumbo jumbo, Java stands out.

So, what makes Java so special and different? In this article we will examine some of the reasons behind the popularity of Java. There are of course other, more subtle reasons behind the celebrity status of Java, and we will also look at those over the course of next few articles.

The Java White Paper Buzzwords

Sun Microsystems had a strange habit of summarizing its business practices and products in eleven words. These eleven words were constantly emphasized to both customers and employees. Java, as one of the original products of the company too received its share.  These buzzwords succintly summarize some of the most important features of the Java programming language

  1. Simple – This is easily the number one reason you should learn Java. Java was intentionally designed to be simple in syntax and clear in semantics. The language intentionally aovids clumsy features such as operator overloading, pointer mechanics, multiple inheritance and use of header files. Java was intentionally designed to syntactically close to C and C++. Further, Java uses the borrowed features without introducing changes of its own. For example, the switch statement could easily have been improved. But to ease the learning process, Java does not introduce idiosyncrasies of its own.
  2. Object oriented – object oriented methodology is a program design technique that has been most popular for the last few decades. Java has been designed to be object oriented from ground-up. This means that Java makes you very hard to write non object-oriented code. Of course, object oriented design is not the only design technique. There are serious but less popular challengers such as pure/hybrid functional design.
  3. Networked – As explained in the previous article, the main reason behind the explosive growth of Java in initial years was the networked and distributed nature of the language. Internet programming has always been easy in Java, thanks to its support for both application level protocols such as HTTP & FTP and  transport layer protocols  such as TCP and UDP. As will be demonstrated later, common operations such as accessing URLs and writing REST clients are amazingly easy in Java.The Java white paper also mentions the distributed nature of Java as implemented by RMI. RMI or Remote method invocation allows you to executed methods on a JVM other than from where it is invoked. This may be a JVM on the same physical machine or a machine located half a world away. In spite of the benefits offered by RMI, it’s popularity has waned over the years primarily because web services offer the same functionality but in a more standardized way.
  4. Robust – Java is a strongly typed language. The language makes all the efforts it can to catch errors at the compile time rather than at runtime. This makes the code less prone to problems. Since Java avoids pointers and their associated math, the chances of runtime problems occurring are further reduced.It must be pointed out that with rise of languages like Python and JavaScript strong typing is falling out of favor.  Programmers argue that language should not limit their capability. This is called duck typing and implies that checking for duck-ness are carried out at runtime. If an object looks like duck, you can invoke duck methods, even if it is not a duck. Behaving like duck is what matters.
  5. Secure – Java security is like onion. There are layers upon layers of it in every nook and corner. To begin with, there are no pointers to fool around. The boundaries between objects are further secured by coding practices such as encapsulation.
    Next, there is a bytecode verifier sitting in the classloader of JVM that makes it impossible to load a malformed and malicious code into JVM. Of course, what can’t be loaded, can’t be run.
    Then there is a security manager that allows running new or untrusted bytecodes in a protected “sandbox” environment.
    Java provides implementation of standard cryptographic algorithms such as RSA and hash algorithms such as MD5 and SHA1.
  6. Architecture-neutral – The Java compiler does not generate machine code but bytecode. This bytecode can be run inside a JVM. Since, there is a JVM for almost every relevant platform, the bytecode can be run anywhere. Thus, the code written on one operating system runs fine everywhere else.
  7. Portable – Though in a sense the architecture-neturality describe above makes a Java program portable, but Java portability goes a step further. First, data sizes are defined by the language and not by the operating system. So the size of an int is always 4 bytes in Java (unlike C and C++). Further, there are GUI libraries  such as Swing and AWT that have consistent behavior/look and feel across all operating systems. A Swing program, for example, appears exactly the same on both Windows and UNIX.
  8. Interpreted – The Java compiler generates bytecode and the interpreter runs the bytecode. Thus Java execution happens as though it were a truly interpreted language (much like Python and PERL). There is a hotspot compiler, but consider it as a performance enhancement feature.
  9. High-Performance – While most agree that Java runs slower than C and C++, in today’s world, performance is not about being able to save that last ounce of bit or CPU cycle. With the rise in popularity of Cloud and Big Data, it’s much more important to scale horizontally – meaning to be able to use a lot of computers simulatenously.
    Java, because it is distributed language, can be designed to run a program on several JVMs on various machine and still give an impression to the client that a single VM is running. This typically requires using 64 bit JVM (for heap sizes more than 2GB) and passing in the -d64 option on Oracle JVM.
  10. Multithreaded – Java supports multithreading. Unlike some of the other languages such as Python and JavaScript, Java’s support for thread is for real and not just an illusion. Java threads rely on the native threads- i.e. the threads provided by the underlying operating system.
    Java was multithreaded from the word go. Unlike C++ where threading was an afterthought, Java has always supported multithreading.
  11. Dynamic – Java is dynamic in the sense that there is a rich support for discovering information about runtime objects. This introspection feature is provided through Reflection API. It allows the programmer to make decisions at runtime.

Leave a comment

Your email address will not be published.