DEV Community

Cover image for Goodbye, Java
Coding Unicorn 🦄
Coding Unicorn 🦄

Posted on

Goodbye, Java

Some time ago I switched from Java to JavaScript for all my pet projects. It was a HUGE relief and I never looked back. When a customer asks me to code in Java, my hair stands up and I run like a rabbit who spotted the wolf. Here is why:

Writing and refactoring serious Java apps on my MacBook Air was a pain. Everything was slow, and it took years to re-index, re-compile, run, test, and refactor stuff. JVM, IntelliJ, Gradle, Spring are damn too heavy. When you work on a multi-module project, your laptop produces enough noise to wake up neighbors, and enough heat to cook pancakes:

Alt Text

You need a super-powerful machine to program with comfort in Java. Or a portable mainframe. No money – no honey.


If you code JavaScript, that's not a problem at all. You can hack JS on your 5-years old laptop and have fun. Working on a huge multi-module project? No problems.

Recently I upgraded my MacBook Air to the latest MacBook Pro. Yes, Java flies on it and I can't anymore heat my apartment while waiting for the compilation to complete. But I don't think we should be buying expensive hardware to be able to program with comfort. It prevents many people from learning and enjoying programming. 1000$ for a laptop to be able to write code? Thanks, but no.

I vote for languages that are a pleasure to use on any laptop – JS, Python, Go.

I love you, Java, but f*ck you! 🖕

Me wearing Fuck You Java t-shirt


Every day, I post coding tips on my Instagram. Let's stay connected! 🦄

Discussion (37)

Collapse
mgrygles profile image
Mary Grygleski • Edited

I do see your points, but then, your assessment is based primarily on your particular usage scenarios and requirements. As a developer advocate in the Java and JVM space, I can understand well some of the pain points that you have expressed about Java. However, just like anything in this world, not everything is built for all usage scenarios. While Java is very capable in doing almost everything, it is clearly not optimal for everything. Just like how we would not necessarily use a cleaver to dice up a small onion, Java is best suited for enterprise-level production systems. As some of the commenters have pointed out, Java is a very mature language platform by now - after having just turned 25 this year (on May 23rd!). Its developer ecosystem is huge and its presence as well as support in the open source community span all over the world! It has actually come a long way and is catching up with the "modern" age (yeah, sadly, in our industry, everything becomes stale really fast). Have you perhaps checked out the newer JVMs which offer a much faster runtime such as Eclipse OpenJ9 and GraalVM, and also Quarkus for its super fast development capability and it's all cloud native-ready?

Collapse
theelitegentleman profile image
Buhake Sindi • Edited

Wow. Thanks for shooting my career. 🤣🤣🤣

One thing you forget is that most of the online services that you use today (from Apple to Netflix to all banking services) all run on Java backend and the JVM is getting better, smarter and building apps is getting smaller and more powerful. I can speak from experience since I build those backends.

Collapse
zilti profile image
Daniel Ziltener • Edited

Your problem wasn't Java or IntelliJ, it was using ridiculously huge enterprise frameworks like Spring.

Also, blaming your atrocious config on the JVM is laughable. How do you think people coded huge Java programs a decade ago? Do you think computers back then were as powerful as a laptop today?

Collapse
siy profile image
Sergiy Yevtushenko

Can't agree more. Putting Spring into any application (including enterprise ones) is a questionable practice by itself. But blaming Java for this is just ridiculous.

Collapse
alainvanhout profile image
Alain Van Hout

Swapping Maven for npm? No thanks.

Collapse
mouhcinetoumi profile image
mouhcineToumi

Thanks for sharing.

Java is might not be the fastest, but It s an old language that evolved in so many areas (web, desktop, mobile...). I think the knowledge It accumulated over the years gives him a huge advantage over other languages (stablility, scalability, security). By the end of the day, everyone picks his favorite weapon for specific use cases.

Collapse
brunooliveira profile image
Bruno Oliveira

Do you have some numbers? :)
The argument Java is slow and JS is fast, for a similar sized project is not very convincing.... Then there's the ecosystem and community and ease of cloud readiness. I simply can't imagine a scenario where in a real world Benchmark from 0 to deployment JS will ever beat Java.... In fact Quarkus and GraalVM will only improve state of the art further... But... To each its own :)

Collapse
omenlog profile image
Omar E. Lopez

Fun article I also really dislike Java not for the same reason that you pointed because I never tried it outside of programming classes at the university. For me as developer who like functional programming Java lacks of expressiveness, I find very annoying and frustrating the requirement to declare a class for absolutely everything, also it's famous for be a very verbose language indeed the fact that I need System.out.printLn() for just print something drive me crazy, in summary isn't for me. But beyond all of this I really think that JVM is an amazing piece of software, indeed there are very good languages that rely on it, as examples we have Kotlin, Clojure, Scala ... JVM is a component that have been battle tested over two decades, in my opinion seem like many people came with the idea to use it and create a language that remove Java ugliness.

Collapse
siy profile image
Sergiy Yevtushenko

Yes, Java is verbose. But why do you assume that verbosity is bad? A lot of typing? Who types every single character in the code these days? In any Java IDE this is only 4 or 5 chars (in Idea it's just 'sout'). And there are static imports as well.

Java verbosity has another side: it provides explicit context and programmers' intent. Which reduces mental overhead and simplifies reading the code. Since most of the time we're reading code, this verbosity makes Java code simpler to support and maintain, especially in long run. This is the one of the reasons why Java found its place in enterprise world.

Collapse
omenlog profile image
Omar E. Lopez

Verbosity isn't necessary to reach explicit content and programmer's intent , indeed as example of this we have Python, many arguing that is very explicit and easy to read and without verbosity at all. In my opinion the fact that verbosity help to reduce mental overhead and simplifies reading code is debatable.

On the other hand verbosity on Java isn't restricted to just one line of code as I pointed with the sout example, is spread all over the language, compare this two snippets in java and kotlin

kotlin-vs-java

Really I don't think that you can address this with 4 or 5 characters in your editor.

OK if you like it use it, as you said, it found it's place in the enterprise world(not by it's verbosity), but anyway isn't for me.

Thread Thread
siy profile image
Sergiy Yevtushenko

I don't have to. Since Java 14 I'm writing such things like this:

public record Book(String title, Author author) {}

It even shorter than Kotlin version.

P.S. yes, there are still areas where Java needs improvement and it actually quickly improves with every new release.

Thread Thread
siy profile image
Sergiy Yevtushenko

And about Python. It's less verbose just because it does not require types. And lack of types (or dynamic types, for that matter) has it's own drawbacks. For example, reusing the same name for variable with different type complicates reading code and creates mental overhead.
Lack of static type checking also requires more careful testing, so in turn programmer needs to write more code to cover things which are handled by compiler in statically typed languages.

Thread Thread
omenlog profile image
Omar E. Lopez • Edited

Very nice this syntax for declare a new record, I didn't know about it, I'm really out of anything related with Java but nevertheless looks good.

Thread Thread
omenlog profile image
Omar E. Lopez

I mention Python but can be others using static types, anyway I think that types or not types are out of the scope in this thread :)

Thread Thread
siy profile image
Sergiy Yevtushenko

I did mean that referring dynamically typed language as an example of low verbosity is not completely correct. And yes there are languages with static typing and concise syntax, for example Haskell. After all, you already referred Kotlin, which also has more compact syntax than Java.

Collapse
alainvanhout profile image
Alain Van Hout

Literally the first link that Google provides for 'js java benchmark' already contradicts the idea that JavaScript generally outperforms Java.

benchmarksgame-team.pages.debian.n...

As to the ecosystem, for java you'll almost always find one or two libraries that fit a particular need, and will do so reliably. On npm you'll often find dozens, but with far less hope for reliability.

That doesn't mean that Java is objectively 'better' than JavaScript (because 'better' is a matter of context and details of a particular use case). But if you feel a deep need to compare, then it's only fair to be accurate.

Thread Thread
brunooliveira profile image
Bruno Oliveira

Thanks for the reply to back up my theory!

I find the original post extremely shallow and mostly clickbait, especially when no real numbers are offered. Everyone is entitled to have a personal opinion ofc, but I worry that some newbies will read this and be mistaken.

Obviously there are really large companies like fb, Netflix and Uber that require js to be at the core of their business but what people do not realize is that the infrastructure, internal systems and tools developed in-house to support this, are not something a small or medium company or much less a freelancer can even dream of affording.

I mean community size and ecosystem wise, npm is an example of how NOT TO WRITE AND DISTRIBUTE SOFTWARE:
zdnet.com/article/another-one-line...

So I honestly don't know what makes js so much better as per the original post.
Nothing in JS is good except its the only thing that runs in the browser... Unsurprisingly industry is already trying to fix this :)

I can twist my arm and admit when I'm wrong, but not without real evidence like: here's an app done in JS in X weeks with changing requirements and deployed production in Y. Then here's the same in Java, but all much worse

Collapse
elmuerte profile image
Michiel Hendriks

Not enough effort is put into creating LL(1) programming languages. If you think Java is slow, then don't look at C, C++, or even JavaScript.
20 years ago compiling thousands of line of Pascal was a matter of seconds. Mainly because IO couldn't keep up.

Collapse
gklijs profile image
Gerard Klijs

It really depends through. If you use a Micronaut and Gradle for example, it is fast. And then there is is runtime performance, which for the few things I tried with Node where far inferior. In my opinion Clojure is kind of best of both, fast dynamic reloads, dynamic types, but the power of the JVM.

siy profile image
Sergiy Yevtushenko

Looks like Java did hurt yours :)
Bad applications can be written in any language, Java is not an exception. Neither is JS and Node.

Collapse
stojakovic99 profile image
Nikola Stojaković • Edited

Don't give up on Java that easily!

I'm a software developer who works primarily in JavaScript (TypeScript) these days and I can't wait to start working on Java project again. Yes, JS is nice for some smaller to medium level stuff, but as you approach bigger complexity of your project, Java gives you many benefits.

Yes, you may not need that powerful machine for running simple Node.js projects, but as soon as you start working on the microservices you'll need powerful machine anyway because almost all new projects these days use Docker.

zilti profile image
Daniel Ziltener

My condolences on so many levels I don't even care to list here... 🤦‍♂️

Collapse
zilti profile image
Daniel Ziltener

And what do you dream about at night?

Collapse
magnus2025 profile image
Magnus Smith

As a Java consultant I earn enough to buy a decent laptop. Problem solved

zilti profile image
Daniel Ziltener

That JavaScript is faster. No, it isn't. Mainly because the JVM still is the fastest VM out there.

Collapse
elirehema profile image
Elirehema Paul • Edited

Denis Waitley, a motivational speaker, says, “Losers try to escape from
their fears and drudgery with activities that are tension-relieving.”

Collapse
siy profile image
Sergiy Yevtushenko

Node is not even close. Just look at Techempower benchmark.

Collapse
functional_js profile image
Functional Javascript

I love your metaphors and tshirts.
You'd make a great opinionated framework. :-)

Keep on unicorning!

Collapse
diogosouza profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Diogo Souza

I’m still wondering if that was...

  • a clear spread of hate
  • a clickbait (what the heck is this pic? Hey, Java haters, let’s exchange #like4likes!!)
  • a failed attempt to be funny
  • an even-more-failed try to explain Java’s cons against JavaScript
  • or an intentional, but weak, satire.

Seriously, unicorn?