Common Misconceptions of Java

Filter Course


Common Misconceptions of Java

Published by: sadikshya

Published date: 16 Jun 2021

Common Misconceptions of Java photo

Common Misconceptions of Java:-

Java is the most widely used language in the world, and everyone has an opinion about it. Due to it being mainstream, it is usually mocked, and sometimes rightly so, but sometimes the criticism just doesn’t touch reality. I’ll try to explain my common misconceptions about Java.

Java is slow –

That might have been true for Java 1.0, and initially may sound logical, since java is not compiled to binary, but to bytecode, which is in turn interpreted. However, modern versions of the JVM are very, very optimized (JVM optimizations is a topic worth not just an article, but a whole book) and this is no longer remotely true. As noted here, Java is even on-par with C++ in some cases. And it is certainly not a good idea to make a joke about Java being slow if you are a Ruby or PHP developer.

Java is too verbose –

Here we need to split the language from the SDK and from other libraries.

There is some verbosity in the JDK (e.g. java.io), which is:

  1. easily overcome with de-facto standard libraries like guava
  2. a good thing

As for language verbosity, the only reasonable point was anonymous classes. Which are no longer an issue in Java 8 with the functional addition? Getters and setters, Foofoo = new Foo() instead of using value – that is (possibly) boilerplate, but it’s not verbose – it doesn’t add conceptual weight to the code. It doesn’t take more time to write, read, or understand.

Other libraries –

It is indeed pretty scary to see a class like AbstractCommonAsyncFacadeFactoryManagerImpl. But that has nothing to do with Java. It can be argued that sometimes these long names make sense, it can also be argued that they are as complex because the underlying abstraction is unnecessarily complicated, but either way, it is a design decision that was taken per-library and nothing that the language or the SDK impose perse. It is common to see over-engineered stuff, but Java in no way pushes you in that direction – stuff can be done in a simple way with any language. You can certainly have AbstractCommonAsyncFacadeFactoryManagerImpl in Ruby, just there wasn’t a stupid architect that thought it’s a good idea and who uses Ruby. If “big, serious, heavy” companies were using Ruby, I bet we’d see the same.

You can do nothing in Java without an IDE –

Of course, you can – you can use notepad++, vim, emacs. You will just lack refactoring, compile-on-save, call hierarchies. It would be just like programming in PHP or Python or javascript. The IDE vs Editor debate is a long one, but you can use Java without an IDE. It just doesn’t make sense to do so, because you get so much more from the IDE than from a text editor + command-line tools.