Hacker News new | ask | show | jobs
by twic 41 days ago
> The boring choice is the right choice. It always was.

Right, absolutely correct, Java is a great choice, so why does this post keep going on about Go?

6 comments

EJB, Spring, Ant, Struts (I'm getting old - Like Hot Java Alpha 3 and Java applets old), maven, pom files, etc.

I used to love Java but the complexity merchants showed up and ruined the party. 1.5 was just coming out when I stopped doing Java dev. Kotlin might pull me back into the fold though for when I can't use Go.

You can write apps without that stuff? Sure you should have 1 dependency management system, but otherwise you can write clean JVM apps in many languages, without DI or much else.
The good stuff landed in Java 8, so you left the party too early. From Java 8 on it has changed direction completely (less OO + JavaBeans, more functional + ADTs). It feels like a completely different language from the Java 1.4 / 5 days.

https://en.wikipedia.org/wiki/Java_version_history#Java_SE_8...

That was a long and dark time in history. We're still in the shadow of it. But these days a much better world is available - a more powerful language, good libraries, and much, much simpler frameworks.

To be clear, all the annotation and Java EE stuff is still going if you want it!

jeberle made a completely factual reply to this, but people hate Java so much it's downvoted to dead.
My big issue with Go is, the language just isn't that great. Zero values instead of sum types, reflection instead of proper macros, a mediocre module system…

Java's warts are far worse than Go. Everything is nullable. There's no module system to speak of. It's so IDE-dependant.

I agree with the spirit of "use boring technology." So thank god Go is boring enough that I don't have to write Java anymore.

> Everything is nullable

Only reference types, the same as in golang (which also has nullable pointers, and its interfaces interact weirdly with null). Java is getting value types, which can be declared as non-nullable.

> There's no module system to speak of.

https://dev.java/learn/modules/

> It's so IDE-dependant.

Modern Java has been simplified that you can run a hello world program as follows:

  $ cat Hello.java
    void main() {
        IO.println("Hello");
    }
  $ java Hello.java
  Hello
Furthermore, any non-trivial project is better served with an IDE, regardless of language.
> Only reference types, the same as in golang

Everything's a reference in Java except primitives, and even primitives get object wrappers. In Java, String, Long, and Bool can all be null. Go isn't like that—only explicit pointer types and interfaces can be nil. In practice it really cuts down on NPEs.

> https://dev.java/learn/modules/

Ok, granted, but I have never seen these in actual use. Java's ecosystem is big enough that you can use Java for years and not even know it has modules. I find this profusion of features unboring for the same reason that C++ is unboring.

In Go, everything's already in modules. It's just simpler. And when they did add generics, it was backwards-compatible, so there was no Java 8/Java 11 thing.

> Furthermore, any non-trivial project is better served with an IDE

In any other language, I can get by fine with vim + LSP regardless of project size. Java has a uniquely bad LSP story.

> Everything's a reference in Java except primitives

Value types will have the ability not to be nullable, which is the same as golang.

Primitive wrappers are used to denote nullability, which golang also has in its sql package for example.

> I can get by fine with vim + LSP regardless of project size

Getting by is one thing, having strong introspection offered by sophisticated IDEs is another.

> Getting by is one thing

Yeah, and it shouldn't be too much to ask for. So it drives me crazy that I can't get by in Java without a full IDE. All I want is "show docs" + "jump to definition" + "show references" + "show implementations". I should not need IntelliJ for this.

> Primitive wrappers are used to denote nullability, which golang also has in its sql package for example.

The nullability wrappers in go's sql package are one of my least favourite parts of the langauge, haha. I really wish Go had proper sum types.

> Value types will have the ability not to be nullable, which is the same as golang.

It's good that Java will eventually add that feature, but I was critical of Go for lacking generics all the way up until they added them. Java's backwards compatibility story isn't as strong as Go's, either. Generics, Go's biggest change ever, were fully non-breaking; meanwhile, some people are still using Java 8.

Go's attitude toward adding features is, "we don't have that & it's fine." If you want to dynamically load code in Java, you have the power to do all kinds of custom class loader magic. If you want to dynamically link code in Go, too bad. Now, I don't love this approach. My favourite language is Rust, which has features out the wazoo. It is beautiful and powerful and complicated. Go is none of those things, but it is austere and minimal and that has its own advantages. Java lacks the advantages of either.

Of course, Java is widely used no matter what I think of it, and it is boring (in the complimentary sense). At the end of the day, it's a fine choice for a project. But as I said earlier, thank god Go is boring enough that I don't have to write Java anymore.

Go probably wouldn't exist if Java devs went easy on overengineering design patterns.

But overall Java, like Go, IS a boring language. And that's a compliment.

Well, Spring (Boot) is so hard to avoid running into at day jobs. And Spring is hell.
Lack of extensive standard library, for one. But yeah Java is pretty great. Spring boot/quarkus especially
Where my brain went.