DEV Community

Mamoor Jaan Khan
Mamoor Jaan Khan

Posted on

Things wrong with Java

This is by no means an exhaustive list.

I honestly think if Sun did not spend millions into Java marketing, it wouldn't have been successful. This is the first language I ever learnt and I hate to say it, but it is because of Java I decided to become a Software Engineer. That is why I am so loud about hating Java. You would be able to guess that I am not a very experienced programmer by the inadequacies here but oh well. Any day I am not programming in Java is a good day for me

  1. Heavily IDE dependant
    Java has this weird environment about it that everyone who wants to write Java is forced to use an IDE. There is no other option. Because otherwise you are subjecting yourself to pain for no reason. Languages that need integrated development environments are just bad overall. They are complicated and convoluted and importing a library becomes a nightmare if done without an IDE.

  2. Object oriented design
    Java is not object oriented anymore to make it more acceptable for devs to use. I am not even joking. There are books like "Functional programming in Java". The idea behind inheritance is somewhat okay but OOD is for sure the worst way to implement that. I feel something wrong whenever I have to do some weird inheritance stuff. Even in the react docs they say: "you can do inheritance with the components but there is always another way to write code to avoid it". Not word for word but something similar.

  3. Rigidity over flexibility
    Coding in Java feels like its own ecosystem where doors are windows and windows are portals to another barren landscape with sand for drinks and guava gummy bears for dinner. The world Java tried to create was how can we restrict the developer as much as possible. Which is justified but not at the same time. While there is need for some rigidity to make computer programs more resilient to attacks, there are so many other ways to do that. Plus I think the more versatile a language is while being secure, the more people will want to use it.

The comments are open to all kind of criticism and improvements :) Anyways, have a good day

Top comments (14)

Collapse
 
cicirello profile image
Vincent A. Cicirello • Edited

Java is not at all "IDE dependent". I rarely, if ever, use an IDE for Java and Java has been one of my primary languages since the 1990s. On Windows, I edit source in Notepad++. On Linux and other Unix-like systems, my editor of choice has varied over the years, but have included emacs and vi.

Not entirely sure what your intended point is on OO. But Java is object oriented. It happens to include some support for functional programming that you can either use or not use. If you want to strictly program in the functional paradigm, Java is not the right language.

I'm really not sure what your 3rd point is, so can't comment on that one.

Collapse
 
lownightsnack profile image
Mamoor Jaan Khan

Oh you've been a programmer for a while. The way you have experienced soft dev, I would probably never be able to.

The way I feel it, today, knowing a language is not enough to be able to contribute meaningfully. There is a need to learn many different frameworks and libraries associated with it to become a software dev. These frameworks have different ways of package management which becomes a nightmare if an IDE is not used.

With OO, the point I was trying to make is the idea of lets say defining the model of a car inheriting a Car class is cool but we can do the same with encapsulation as well which feels more natural.

3rd point is i guess my way of saying this

My POV is of an fresh graduate of Computer Science. So doesn't amount to much. But thank you for caring.

Collapse
 
cicirello profile image
Vincent A. Cicirello

Frameworks come and go more often than the underlying language. I recommend first focusing on the fundamentals of the language. If you get those down, then adapting to the framework-of-the-month will be easier. Although the whole chasing the latest framework thing is worse for some other languages like JS than it is for Java. I haven't seen a Java framework yet that required a specific IDE. As I mentioned, I use a code editor rather than an IDE. But I do use a build tool to run the build for a project (compile, run tests, etc). Currently I use Maven. In the past I've used Ant, and way back Make. I haven't used Gradle, but I know some find it easier than Maven. Maybe try a build tool like Maven or Gradle. You can definitely build Java projects that use frameworks like Spring with such build tools. But again I recommend focusing on the fundamentals first before frameworks.

In OO, sometimes using inheritance makes sense, while other cases call more for composition, etc. This really isn't just a Java thing though. Quite frankly it's usually best to keep inheritance hierarchies shallow. Many textbook examples of inheritance give the false impression that you need to have deep levels of inheritance.

Collapse
 
sreno77 profile image
Scott Reno

Don't forget that's it's very verbose

Collapse
 
lownightsnack profile image
Mamoor Jaan Khan

Yeah true. Write tons of Java for a simple "Hello World." Frustrating

Collapse
 
khmarbaise profile image
Karl Heinz Marbaise

Really? Tons?

interface Main {
   static void main(String[] args) {
     System.out.println("Hello World");
  }
}
Enter fullscreen mode Exit fullscreen mode

Is that short enough? Apart from that how many times do you write that?

With JDK21 there is a preview to make that even more shorter (openjdk.org/jeps/445) like this:

void main() {
    System.out.println("Hello, World!");
}
Enter fullscreen mode Exit fullscreen mode

Apart from that, is that really important?

Collapse
 
khmarbaise profile image
Karl Heinz Marbaise

In which way? Do you have examples?

Collapse
 
andreciobezerra profile image
Andrecio Bezerra

VSCode support to Java is very good

Collapse
 
lownightsnack profile image
Mamoor Jaan Khan

Yes but VSCode is also an IDE

Collapse
 
cicirello profile image
Vincent A. Cicirello

VSCode is a source code editor (as defined on its official website), not an IDE. There are many optional extensions available that can add IDE like features to it for whatever language you are programming in.

Collapse
 
andreciobezerra profile image
Andrecio Bezerra

Someone coding Java on Neovin, or you say that Neovin is an Ide ?

Thread Thread
 
lownightsnack profile image
Mamoor Jaan Khan

No Neovim is not an IDE. What I meant was VSCode is a text editor by definition, but in its use, there is very heavy preference to using extensions. But now that I think about it, isn't that the case with most of the text editors? Yeah I am confused. Never mind.

The point I was trying to make was it becomes a nightmare creating and managing packages in non-supported text editors.

Collapse
 
khmarbaise profile image
Karl Heinz Marbaise

technically you can write Java, Go, JavaScript, TypeScript, Rust, C, C++ with a simple editor (for example Vim, Emacs, Neovim)... but that is not productive...

Collapse
 
khmarbaise profile image
Karl Heinz Marbaise

About 1: As others already explained you are not forced to use an IDE to write Java code... neither this is neccary for C, C++, Go, Rust, TypeScript, JavaScript, Kotlin, Scala, PHP, Python, VLang, etc., but this is not productive, because IDE's are supporting not only the language with refactoring, code completion, executing of tests, searching, frameworks, support for databases, version control etc. to mention only a few aspects. This is the daily business writing code.

About 2: You are talking very generally about a problem you might have with non OOP aspects of Java, but where is the real problem having a language which supports functional aspects as well (as other languages do as well). More important it's evolving over the time.. as other languages do as well (for example Go, JavaScript, TypeScript, C++, C, Rust etc.)..

It's really funny to read/hear one part of people saying: "Java is OO only".. really bad... others telling "Oh Java is not only OO anymore" it's bad...

About 3:

The world Java tried to create was how can we restrict the developer as much as possible. ..While there is need for some rigidity to make computer programs more resilient to attacks, there are so many other ways to do that.

In which way are devs restricted and what are those "other ways"?

Plus I think the more versatile a language is while being secure, the more people will want to use it.

The language itself is not really the problem.. Apart from that Java (incl. JVM) is getting more and more secure over the time..

I feel something wrong whenever I have to do some weird inheritance stuff.

What do you mean by that?

Even in the react docs they say: "you can do inheritance with the components but there is always another way to write code to avoid it".

A general advice is composition over inheritance. This is not new.