Live data from Hacker News

Java Is Underhyped

jackson.sh

651–660 of 808 posts

Re: Java Is Underhyped

#651
post #73

Earlier quoted context omitted.

I actually laughed out loud at the Java.com homepage. I was so surprised, I expected a sleek, modern homepage but instead I got a portal to 2010.

To be fair, lots of websites were far better in 2010 than today’s white space filled, massive typography, bright colored potpourri of rounded corners, scroll jacked bullshit. Full screen, infinite scroll, hamburger menus. So many awful contemporary design choices. Don’t pool it all together with this Java website - which sucks but not because it was from 2010. I abhor and loathe modern web design.

I love old web design too. Sometimes I go look at 2007 WorldOfWarcraft.com on Archive.org to enjoy old design.

I just remember the Java.com homepage from visiting it in computer lab in 2011 so I could play Minecraft.

Re: Java Is Underhyped

#652
post #7

There are a few reasons to avoid Java today. - The programs are very verbose for the functionality they provide. There are countless lines of getters, setters, and trivial constructors. While IDE helps to write them, it makes reading existing programs slow and frustrating. Lombok helps, but very few programs use it. - If you do want to use Java ecosystem, there is Scala. It also has strong type system, nice IDE suppo…

I think of Java as hitting an 'anti-sweet-spot': - It forces us to go through the ceremony and verbosity of static typing, yet blows away lots of the benefit by pervasive use of `null` and `Object`. Compare this to ML or Haskell, where there's less ceremony (Hindley-Milner type inference) yet more safety (no `null` or down-casting) - Checked exceptions have a similar ceremony and verbosity problem, yet the pervasiven…

Not really following or agreeing with most of your arguments here but on the subject of Checked/UnChecked exception I agree. Java would have been better off with simply Checked exceptions and errors and no RuntimeExceptions. The current lovefest for unchecked exceptions in Java is very unfortunate. New features like lambdas don't work well with checked exceptions and there seems to be little urgency in rectifying those shortcomings either. Instead everyone is just switching things to use unchecked exceptions. For people running stuff in web containers I suppose it hardly matters, a single request fails, no big deal but for other types of programs having checked exceptions is invaluable.

Re: Java Is Underhyped

#653
post #228

Earlier quoted context omitted.

Yes, they are: @FunctionalInterface public interface ThrowingConsumer { void accept(T value) throws E; } public static void forEach(Collection elements, ThrowingConsumer consumer) throws E { for (T element : elements) { consumer.accept(element); } } There is a significant shortcoming, which is that you can't catch exceptions using the type parameter - this does not compile: public static Optional forEach(Collection e…

Yeah, that sort of works, though I’m not sure a function that throws two distinct exception could be compatible with a generic method that takes functions throwing three distinct exceptions (that may sound crazy but some java.security crypto stuff does it).

Looking back on it now I think our revulsion to simply using "throws Exception" ought to be re-examined. In practice, while it's nice to know exactly what kinds of exceptions are being thrown it could be the emphasis on this actually holds us back. What's more important is whether an Exception could be thrown at all versus none.

Re: Java Is Underhyped

#654
post #488

Earlier quoted context omitted.

I think Kotlin is pretty much what a modernized Java should be. Between it and Clojure I don't spend very much time with Java anymore.

Kotlin could he better, but doesn't go all the way. Without HKTs and implicit injection, Java is going to eat its lunch. Java already has records, type inference, parametric null safety with Optional, Loom provides coroutines, vavr and streaming apis have given us theabilitytodo FP... what's left as a unique feature? Kotlin will survive because it was picked for Android to avoid copyright issues. But the difference b…

When Java gets the Kotlin's brilliant "last argument of lambda type can be a block", let me know. It allows to massively extend the perceived syntax of the language where needed, and create nice, typechecked DSLs. A number of small ergonomic improvements is also impossible to port to Java.

And I'm definitely happy that Java does not feature implicit injection, which looks so cool but is so painful to work with in Scala.

When I need HKTs, I can pick a perfectly good Haskell :) I'm afraid Java or even Kotlin will never achieve this level of FP-ness; for that, a language should be designed differently. Rust, OTOH, likely will.

Re: Java Is Underhyped

#655
post #343

Earlier quoted context omitted.

It's horses for courses. Some plus points for Java: - you can integrate code from hundreds of developers fairly safely (knowing that no one has changed the default behaviour fo builtins and different dependencies won't clash). - the syntax, although not the most succinct is fairly easily readable and maintainable by other developers.

> - you can integrate code from hundreds of developers fairly safely (knowing that no one has changed the default behaviour fo builtins and different dependencies won't clash). It's exceedingly rare for this to be untrue of Python — it's technically possible to hack builtins but there's intense community pressure against doing that. > - the syntax, although not the most succinct is fairly easily readable and maintain…

It's true that Python programmers don't often hack builtins, but they still do things which aren't possible in Java.

For example: imports inside functions instead of at the top of the file (because the import does work, but the configuration hasn't been set up yet).

An example of this is an internal package at my workplace which makes a external service request at import time.

Re: Java Is Underhyped

#656
post #395

For my use cases, Java has all the wrong compromises: - not high level enough to compete with Python/Ruby/JS/PHP, etc - not low level enough to compete with Rust/D/Nim/Zig - not specialized enough to compete with Erlang/R/Go/Julia - not opinionated enough to compete with Lisp/Haskell So why use Java ? It's good, it's fast, it's productive, it's well supported, battle tested and documented for decades with a huge pool…

Your premise is that you are able to chose a language based on how appropriate it is for a specific use case. This alone shows you are not the typical user of Java! Java is typically used in larger or long-lived organizations. It is rare to start new projects from scratch. Most development is maintenance and extension of existing systems. Even if you start a greenfield project, it would be most prudent to chose the s…

Yes of course, don't fix what's not broken.

It's orthogonal to my point though.

Re: Java Is Underhyped

#657

Earlier quoted context omitted.

Nobody has started a project with Ant in the last decade. Of all the Java projects on Github Ant is probably not even 1%. > Oh and now I have to make it work in the IDE too, click through a billion menus and dialogs, You click "Project from existing sources" in IntellIJ and it will recognize both Maven and Gradle projects and just work? Sync the dependencies? configure runtimes and classpaths? What? With Maven and Gr…

I'm talking about a maven project I have to use sometimes at work. Let me walk you through all the shit I had to do: - Install and set the right java version system-wide - Copy some config files for the project system-wide (granted, this is not java specific, but still) - Click in some IDE menu to enable some build settings - Click in some IDE menu to install some "Lombok" plugin - Click in some IDE menu to select th…

If you're using IntelliJ from JetBrains, there should be an option to store the run profiles for the project in the version control system.

Even if your project is so messy, then you should be able to just to version a working setup (maybe needing to figure out how to make the correct JDK version be used across different machines) and after that it'd become a question of just having to check out the project from the version control system and click a green button in IntelliJ.

This most likely wouldn't solve all of your issues, but at least would help make onboarding slightly less painful and slow.

Re: Java Is Underhyped

#658
post #617

Earlier quoted context omitted.

> main complaint about Python is trying to use someone else's software. Then it degenerates into a maze of twisty little passages of trying to install the correct set of dependencies, not knowing where those files are installed Java is far worse on this front. Let's take a look at JEE or Spring - The entire experience is akin to summoning a demon with waving reciting correct incantations in correct places while havin…

Well, it does considerably more things than a hello world python app. So at least compare it to Python’s full blown backend server with ORM and the like.

Django: zero dependencies for years, you could literally copy paste the code and it worked, ORM included.

It now has 2 dependencies. It is a 1000 times easier to use than hibernate, despite being one of the worse ORM in Python.

That the problem with old Java libs like Swing or Hibernate: they have been designed for the 90' and don't leverage the potential of what a modern Java version can do.

Re: Java Is Underhyped

#659
post #457

Earlier quoted context omitted.

With respect, you're wrong. I say this because we're now seeing widespread adoption of serverside Kotlin at places like Google and Amazon. With the support of Google and Jetbrains they can target whatever they want.

With respect, welcome to the Kotlin version of #ifdef, where language features depend on the underlying runtime. That 3D graphics library using SIMD and value types from JVM on ART or JS? Good luck achieving the same perfomance and memory semantics. Kotlin/Native has already been rebooted as its memory model was incompatbile with JVM libraries.

It’s worked out ok for scala (though i don’t think anyone cares about it for android). Obviously a lot of code that only works on the JVM, because a lot of people just don’t care about native/js. But most core libraries will have ‘shared’ pure scala code and then have the platform specific implementations in separate folders. This is all fairly standardized with sbt plugins to do all the heavy lifting.

From the app side you just don’t use classes that you can’t use?

It will be interesting to see how things like Valhalla and Loom will pan out.

Re: Java Is Underhyped

#660
post #458

Earlier quoted context omitted.

I agree that Java is low risk from a manager responsibility perspective: nobody has been fired for choosing it for a long time. Now, from a project success perspective, I think it's not. I've seen a lot of Java projects fail, over engineered, full of spaghetti code, riddle with inscrutable abstraction, stuck in a glue of badly designed architecture that has been fossilized by the type system. I'd say from a project r…

I have seen a lot of projects fail over the years, for many different reasons, but I have never seen a project fail due to the choice of programming language. > I've seen a lot of Java projects fail, over engineered, full of spaghetti code, riddle with inscrutable abstraction, stuck in a glue of badly designed architecture that has been fossilized by the type system. Sure, but do you really think the same organizatio…

It's an anwser to "You use Java because it is low risk". I just don't think it's immune in any way.
Post reply on HN