DEV Community

Play Button Pause Button
Grzegorz Piechnik
Grzegorz Piechnik

Posted on

Why do I hate Java? πŸ˜ πŸ€”

I dealt with these languages on a daily basis and I must admit, I wouldn't want to deal with them in the future. Nothing has robbed me of sleep quite like they have... πŸ’€πŸ™…β€β™‚οΈ

Top comments (43)

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard • Edited

Java itself is one of the most important languages ever, the people who did it were right about many of the big things.

See this tribute to Java by the designer of a language meant to replace it

elizarov.medium.com/a-tribute-to-j...

What you need to hate are the Enterprise Supposedly Best Practices that were handed down by J2EE, Struts & other coding horrors.

Lesson learned: never accept "Best Practices" at face value.

Collapse
 
pgradot profile image
Pierre Gradot

Let me grab a beer and watch you code in COBOL πŸ‘€

Collapse
 
latobibor profile image
AndrΓ‘s TΓ³th

I don't have extensive knowledge with it, but one thing is sure: whenever I have to work with Java the following things are going to happen:

  1. I would need to increase the heap in my .bashprofile through an obscure command that everyone else copies from each other.
  2. There will be 6 million lines of console logs you can only understand if you are already a pro. There is no way you will only have 1 relevant error message that you can google. You won't even know where to start!
  3. You are going to be lost in the folder structure. ./dist or ./build? Nah! ./android/build? Nah! It's ./android/app/build/outputs/release and not ./android/app/build/generated.
Collapse
 
siy profile image
Sergiy Yevtushenko
  • that command is documented. and not all apps require it
  • stack traces are pretty straightforward. moreover, they look similar in different languages.
  • folder structure is created for purpose.

Overall your complains are about you reluctance to learn rather than about language. Actually nothing of the above is about language, just specific setups and projects.

Collapse
 
latobibor profile image
AndrΓ‘s TΓ³th • Edited

One more thought to my original comment: what I had was feedback. The language and resources around it won't improve themselves if you are simply told your feedback is wrong. Every 5th year for a software engineer should be trying out some other languages professionally (if I could magically find time and money for this). I had to move from C# to JS, from JS to TS, I tried out python for half a year and started working with PHP.

All of them had advantages/disadvantages to the other.
You can't beat JS world with setup. You download node/deno/bun and it just works. You start up your application there is no noise of 600 logs, it's very clean.
But then with features (even simple things like import/export) you have to stuff around it. What C# ecosystem knew in 2010s you still don't have 2020s and so on.

Python was a nice language, but having to manage pip/pip3, different versions of the runtime was a bitter hell. Also types are not nuisance only, they can be extremely useful to communicate the input/output of your code.

I can only recommend trying out other languages with open eyes, exactly the same way you go to another country: if you are just an American tourist who tries to drive through Tokyo in a giant pick up, you will miss how effective mass transportation work, how you can buy delicious food in the train station, how the bullet train arrives on time, really, and so on. You have to take those and bring it back and try to adapt the good stuff.

Thread Thread
 
siy profile image
Sergiy Yevtushenko

For most popular languages, once you mastered one from C-family, getting others is easy but does not add much new knowledge. Non-C-like languages usually add not much more if they are imperative/OO languages. So, for example, learning Python after Java is "meh". Things change if a language is functional or, at least, with a significant functional component. For example, Haskell, Scala or Rust significantly affect the thinking and understanding of the code even for languages one already know for years.

Collapse
 
latobibor profile image
AndrΓ‘s TΓ³th

Well, regarding the language, it always felt lagging behind C# many years. If I would have time now to learn a language, definitely I would not spend it on Java, but rather on Rust, Zig or Kotlin (or maybe Swift).

Thread Thread
 
siy profile image
Sergiy Yevtushenko • Edited

None of these languages are a replacement for Java.

EDIT: Expanded version of response:

  • Rust and Zig have a somewhat different area of use. Even if Rust could be used for backend development, productivity is lower and the final app is barely faster than one written in Java. Also, Rust could be quite verbose in some cases. Its safety rules and borrowing model are great for lower level applications, but they impede development performance for the higher level apps and often require making changes in design to fit into these rules.
  • Kotlin has no sensible advantages over Java feature-wise, but it is inconsistent, poorly thought out and significantly more (and unnecessarily) complicated than Java. Its syntax is inherently more noisy. Some "features" and attempts to "break Java rigidity" resulted in the need to establish and maintain project-wide rules. This negatively impacts development productivity and makes Kotlin less suitable for long-living projects. Worse is that there is no tooling which would help to automate the process. For example, function return type inference is usually prohibited because it makes code difficult to read and reason about. Extension methods either not allowed or their use and placement strictly constrained. Otherwise, they tend to spread across the whole code base and developers often "reinvent" them with slightly different names and identical or slightly different functionality. Etc. etc. etc.

P.S. Don't get me wrong, I love Rust and definitely recommend learning it. It just not a replacement for Java for enterprise backend applications.

Thread Thread
 
latobibor profile image
AndrΓ‘s TΓ³th

I agree that Rust and Zig are for different purpose. Regarding Kotlin and Java I have no relevant experience, just a trend that most people working with Java was planning at least to go with Kotlin or something else.

I also noted the omission of C# in your answer. With that language I only have extensive knowledge when it was hard-wired to IIS and Windows. Apart from that disadvantage, the language itself and Visual Studio was a delight to work with; In 2009 you could rewrite a function during debugging(!!!) and then continue execution.

Much of hate for C# in my opinion was Microsoft paranoia and the fact it wasn't "free to use". People pay a lot more for AWS bills, but I guess that's a different budget.

Thread Thread
 
siy profile image
Sergiy Yevtushenko

just a trend that most people working with Java was planning at least to go with Kotlin or something else.
And then return because in real life very few languages can compete with Java regarding ergonomics of the whole ecosystem/tool chain/IDE's/various tooling/etc. And recent updates to the language significantly reduced the incentive to try something other because feature-wise, Java basically caught up with competitors. In some cases, it got features even ahead of them, for example, sealed interfaces in Kotlin appeared after sealed interfaces in Java. I believe that a widespread transition to a more functional style will make Java even more popular than before. And I'm working hard to make it happen.

Yes, I've not mentioned C# for the simple reason of not having enough experience to draw any conclusions about the language itself. But I'm pretty sure that limiting C# and .Net to Windows was a wrong move. Technical superiority is not enough to win developers' hearts.

In 2009 you could rewrite a function during debugging(!!!) and then continue execution.
I do remember doing something like that in the Eclipse sometime around 2005 or 2006. Overall, Java IDEs are superb, even less popular ones like NetBeans.

Collapse
 
adaptive-shield-matrix profile image
Adaptive Shield Matrix • Edited

I started as a Java developer.

Java the language itself is fine.
Its very verbose (similar how Svelte developers feel about React).

The Ecosystem/Culture around it is the main problem.
Where are so much "have to do" best practices and entrenched indoctrination, that you lose any resemblance of joy.

The Spring Framework (most used framework in the java ecosystem/industry) that makes you feel like an idiot, because its 100x more complex than java itself does not help as well. Being a Framework it has its own APIs for everything without any IDE features or autocompletion -> so you have to basically have to remember everything.

Its just easier to learn a completely new language (rust, go, scala,javascript/typescript) and its ecosystem and switch the company and the job
than to fight against hardened, outdated beliefs of how everything should be done (mostly about 10 years ago outdated knowledge).

Collapse
 
siy profile image
Sergiy Yevtushenko
  • Modern Java is not verbose.
  • Completely agree about "best practices" (they're nothing else than cargo cult) and Spring. That's why few years ago I've started working on modern functional style for Java and framework which completely supports it. And stopped accepting jobs with Spring :)
Collapse
 
adaptive-shield-matrix profile image
Adaptive Shield Matrix

Modern Java is STILL very verbose in comparison to other languages.

Take one look at a Collector API and say, with a straight face, that this is the most easy/minimal way of grouping things.
docs.oracle.com/javase/8/docs/api/...

You migrated to other functional frameworks -> I migrated to Scala. To this day I think Scala provides the best possible developer experience for backend devs.

Thread Thread
 
siy profile image
Sergiy Yevtushenko
  • That's not true. Modern Java code is comparable to other similar languages. It does not have to be minimal and win conciseness contests to be not called verbose.
  • Hmm. Your link shows two things. You're not aware that version 8 is not modern (the current version is 21). You're not aware that in modern Java, Collectors are used only when other methods are not enough. For example, modern version of streams support .toList(), .toSet() etc. methods, without the need to use Collectors.
  • I'm glad that you like Scala. But I don't understand why liking one language requires hating the other.
Collapse
 
adaptive-shield-matrix profile image
Adaptive Shield Matrix

I remember then at the company I worked for: we had the choice between Angular 2 or React, because angularjs version 1 was deprecated and no code between v1 and angular v2 could be reused and had to be completely rewritten from scratch.

Java developers looked at React, noticed that HTML and Javascript is bundled together in JSX
and have gone on a holy crusade against this heresy, breaking some abstract design patterns like "separating of concerns", etc.

Collapse
 
ingosteinke profile image
Ingo Steinke

I am curious about the rest of the rant! Please follow up! Of course I can already guess, but I used to be grateful for Groovy when I worked with a Java-based framework. My most dreaded Java aspect were overly verbose boilerplate code for the most simple things like reading from a file or 20 pages of unhelpful stacktrace for the most trivial errors. But React did a great job to replicate some of Java's problems in JS (and adding all of the problems of scripting languages and hyped ecosystems).

Collapse
 
adaptive-shield-matrix profile image
Adaptive Shield Matrix • Edited

"React did a great job to replicate some of Java's problems in JS" -> React was the rebel kid in town, it introduced JSX (HTML in JS) -> that angered any "separation of concerns" person there is.

Angular follows java practices / modularity much more closely.

Luckely, now every developer does not need to use frondend frameworks to create a website.

They can just use
1) template engines,
2) HTMX, or
3) Astro

Svelte - is currently the most beloved JS framework and 10x-100x easier for beginners to learn than React.

Collapse
 
ingosteinke profile image
Ingo Steinke

React [...] introduced JSX (HTML in JS) -> that angered any "separation of concerns" person

JSX also has a very ugly syntax and makes devs use JS where pure HTML would have been more appropriate. But they even went a step further and introduced CSS-in-JS, abandoning many of the potential advantages of coding proper CSS and using stylelint.

Luckely, now every developer does not need to use frondend frameworks to create a website. They can just use

100% agree, but what they can use depends on the requirements! Make a small website? Any static site generator will do. Create a complex web app? What about a classic multi-page application with a server-side backend? I remember getting frustrated trying to use Node Express with TypeScript. Hopefully times have changed. When we need a CMS for non-technical webmasters or a webshop, it gets more complicated. I currently work on a Symfony-based setup with a PHP backend and Vue JS and Twig on the front end. Sounds overengineered but prevents reinventing the wheel for every single use case, especially when working with currencies and taxes.

I have never tried Svelte, Angular, Astro, or HTMX yet. Maybe I need more time.

Thread Thread
 
adaptive-shield-matrix profile image
Adaptive Shield Matrix

Svelte, HTMX and Astro are

  • very easy to get started
  • as near to web fundamentals and basic HTML + CSS as one can be

Its a great time for dev now, we are now spoiled with choice.

Collapse
 
pavelee profile image
PaweΕ‚ Ciosek

Why do Java Programmers wear glasses?

Because they don't C#.

πŸ˜…

Collapse
 
siy profile image
Sergiy Yevtushenko

Why C# programmers joking about Java?
Because they C# that Microsoft lost the battle.

Collapse
 
1301536601 profile image
benxiong hu

I thought it was a very interesting comment

Collapse
 
dev_geos profile image
Dev Geos

Java is the first programming language I learned ...
Between wordiness and rigid structure, I don't know what I hated the most...

It was after released of JVM 8, many things had changed... Hard to find good tuts with the new features on web..

One day, I meet python and since, It is a love story...

Collapse
 
siy profile image
Sergiy Yevtushenko

Modern Java is concise and expressive. And "rigid" structure is a feature one start deserving much when it is necessary to start working on already existing project.

Collapse
 
dev_geos profile image
Dev Geos

I do not tested last versions but Python is very good for me, I will not change.
Few errors, flexible, learning easy, better pratice and django as framework for web developpement πŸ‘Œ

Thread Thread
 
siy profile image
Sergiy Yevtushenko

Dynamically typed languages have inherent issues, which make them unusable for large and long-living projects. The need to write many more tests to achieve the same level of defects negatively impacts productivity. And easy learning is a one-time advantage. Especially given that Java is a rather simple language, too.

Thread Thread
 
dev_geos profile image
Dev Geos

We don't have same meaning of simple

Thread Thread
 
siy profile image
Sergiy Yevtushenko

Java indeed a simple language. But, like any other language out there, one can't just learn the language itself and start writing production code. It is necessary to know numerous ecosystem elements. Even getting briefly familiar with them requires significant efforts.

Collapse
 
nigel447 profile image
nigel447

some historical context

1 late 90's Aus govt/defense threw away 300 million on a failed mega project over the horizon radar project Jindalee Operational Radar Network Project..

2 in review the issue of team collaboration and mega C++ code bases came up as a significant reason for the projects failure
3 Not long after this Java arrived as a solution for these issues, basically a verbose language any idiot(recent comp sci grad) could real like a book, the advantages being team members could read other peoples code and understand it quickly.

Collapse
 
ccmjga profile image
CCmjga

If you don't like Java, it could be because you haven't tried the newer versions yet. Java 8 is indeed quite old, and Hibernate can be heavy. However, Java 17 or 21, along with previous versions, have undergone significant changes. I suggest giving Spring Boot 3 and jOOQ a try, along with Java 17. It might change your perspective.

mjga.cc
github.com/ccmjga/mjga-scaffold

Here is a rapid development framework that allows you to experience Spring Boot 3, jOOQ, and Java 17 directly. To get started, simply run the provided docker-compose.yml file.

Collapse
 
siy profile image
Sergiy Yevtushenko

The biggest Java problem is the Spring.

Collapse
 
alexmario74 profile image
Mario Santini

I'm sorry to read you had so hard time working on Java.

I would like to ask you why, and in which way, working with another language will be different?

And which language you think will address your issue better than Java do?

Collapse
 
ranjancse profile image
Ranjan Dailata

Java was one of the primary programming language that was part of the curriculum. However, those "Java" days are over for the majority!

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

Why?

Collapse
 
dtangledsarjapur profile image
dtangledsarjapur

It's refreshing to see an honest discussion about personal preferences and challenges with a programming language. This type of introspection contributes to a nuanced understanding of language choices, allowing developers to share their experiences and potentially find solutions or alternatives. Your willingness to express both frustration and curiosity fosters a healthy dialogue within the programming community. Keep sharing your insights, as it adds valuable perspectives to the dynamic world of software development!

Collapse
 
highcenburg profile image
Vicente G. Reyes • Edited

I took Java 3 times in college back in 2008-2012. I never learned it.

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

How did you manage to have a video in the DEV banner ? How long can it be ? Curious

Some comments may only be visible to logged-in visitors. Sign in to view all comments.