Live data from Hacker News

Java Is Underhyped

jackson.sh

231–240 of 808 posts

Re: Java Is Underhyped

#231
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 pervasiveness of unchecked exceptions prevents us actually having much confidence that calls will succeed. Compare this to effect systems, even rudimentary ones like Haskell's (`Maybe`, `Either`, `IO`, etc.): if a function doesn't return one of these 'effect actions', we can be pretty sure that it will succeed (the only unchecked exceptions I've encountered in Haskell are pretty catastrophic things like OutOfMemory).

- It needs to be compiled ahead-of-time, which requires more tooling, makes automated testing more annoying (we have three different failure-reporting mechanisms: app compile error, test compile error, test failure), tools like REPLs are second-class afterthoughts, etc. Yet the resulting bytecode still requires an interpreter (JVM), which takes a while to spin up, and makes deployment and packaging harder (we don't have a self-contained binary).

- It pushes an OOP style, but requires that we keep subverting it; e.g. pervasive use of using structured-programming constructs like `for` (which other OO languages like Smalltalk avoid in favour of method calls), which requires we break encapsulation/implementation-hiding (e.g. if we loop with an 'Iterator', we need to know whether anything we call will use that same Iterator).

- It seemingly pushes a high-level, highly-abstracted design (methods calling other methods, classes maintaining their invariants, etc.); but then throws threading into the mix, which breaks things into such low-level pieces that even 'i++' needs to be thought of in terms of constituent parts (read, increment, write, return).

I agree that Scala's better (e.g. reducing a lot of the typing ceremony; making it easier to remain high-level/abstracted (e.g. encouraging 'map' and friends rather than effectful loops), etc.); it inherits some of Java's problems (and doesn't even flag checked exceptions!), but it's nice enough to tilt the balance in many cases.

Re: Java Is Underhyped

#232
post #83
post #78

Earlier quoted context omitted.

Thank you, good point. I forgot about HashMap's type unsafety even though I wrote the following monstrocity a few days ago to loop over a HashMap Iterator ghostI = hashtableNPCs.entrySet().iterator(); while (ghostI.hasNext()) { ExpiringEntityPlayer expiringEntityPlayer = (ExpiringEntityPlayer) ((Map.Entry) ghostI.next()).getValue(); } Apparently this is the only way to do it, and the Map.Entry type absolutely nukes a…

You are supposed to use generics: Iterator > ghostI = hashtableNPCs.entrySet().iterator(); while (ghostI.hasNext()) { ExpiringEntityPlayer expiringEntityPlayer = ghostI.next().getValue(); } However, it's a sham. The generic types are stripped at runtime. The compiler will prevent you from putting values in the map that are not an ExpiringEntityPlayer, as long as you are diligent in using generics everywhere, and don'…

This is exactly like saying all types in C or C++ are a sham because you can cast a typed pointer to a void pointer.

Re: Java Is Underhyped

#233

Earlier quoted context omitted.

Go/Rust will get you hired in Silicon Valley working on "cool" teams. I believe a bunch of AWS teams are deep diving into Rust, and not to mention the hundreds of startups working in Go/Rust. However, the sausage is still made Java. Amazon, Google, and Apple are, as far as a I know, primarily Java shops. It's just no one ever starts a blog with "Here's something cool I did in Java".

Ah yes, I keep forgetting that HN folk are American-centric and often either do not know or forget that the vast majority of developers do not actually live there, or work for FAANG. Outside of USA, a little digging I did via Glassdoor: Buenos Aires, Argentina: - Rust: ~5 jobs - Go: ~3 jobs - Java: ~800 jobs Lisbon, Portugal: - Rust: ~6 jobs - Go: ~30 jobs - Java: ~278 jobs Barcelona, Spain: - Rust: ~1 job - Go: ~50…

Not just American-centric, but "Silicon Valley working on "cool" teams"-centric. Across all jobs in the US, Go and Rust are still a tiny share.

Re: Java Is Underhyped

#234
post #172

Earlier quoted context omitted.

I didn't, thanks. I think that there are use-cases in which java is more performant than his low-performance options, and can be as performant as his high-performance options, while providing a much larger ecosystem. I think the parent poster actually makes a very weird set of choices - "when my high level choice, python, is not cutting the mustard, I am happy to throw away breadth of support entirely in the name of…

Eh, kinda still sounds like you did. Thanks for removing any doubt.

Perhaps you could enlighten me then? Rather than just posting low-effort, content-less, drive-by snark?

The OP even says they're just posting their own selection criteria in other comments.

Re: Java Is Underhyped

#235
Java is undermined by the orthodoxical OO culture around it. As a language, it's a pragmatic one with no fancy features to get excited about. Similar in design philosophy to Python or Go. What ruins it is its conservative dev culture stuck in the OO craze of the late 1990s.

Re: Java Is Underhyped

#236
post #176

Earlier quoted context omitted.

> You know the joke: a dev has a problem, uses Java, and now has a ProblemFactory :) I think this joke is probably about as dated as the versions of java it was made about.

Unfortunatly, I know a lot of devs that don't even know it's a joke. Singleton is still a design pattern used in the wild.

I'm not going to argue there are lots of ridiculous patterns out there, which seem to be embraced and encouraged by the various frameworks that a lot of developers seem to rely on.

Why bother setting things up explicitly in the way you want when you can declare things as injected, other things as singletons, and then have no real idea why it all went horribly wrong?

Re: Java Is Underhyped

#237
post #136

Earlier quoted context omitted.

Python projects that start to grow has a tendency to become hard to manage in a way that I have not seen in Java at all. Java is like you say not the greatest at anything but it is also not the worst at anything. Its great for projects where the you don't know what you should optimize for or don't care. If java is to boring maybe kotlin is the way to go. I really like kotlin and in my personal experience the only dow…

I write software in Java. I can't stand python - too wishy-washy. But my 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 (which makes it difficult on a cluster, as you may need to do the install on every node separately). Then you try using p…

I came to say say that's not a language problem, that's a packaging problem. But that would be misleading.

The reason packaging is still a problem in Python are linked to the language:

- to get perfs, you need compiled extensions, which java doesn't need. So a Jar can be fast and portable, while in Python it's an "or" proposition. Wheels help, but they still are OS dependent, so you need a build per OS.

- PYZ arrived very late in Python, while WAR were a very early thing in Java. Few people even know you can distribute a whole Python program in a single zip file with dependencies using something like shiv (shiv.readthedocs.io). So few people do it, and it's a shame. We do it for 0bin though: https://github.com/Tygs/0bin/releases. And it doesn't solve the wheel problem, although nuitka does but it a higher prices to pay.

- packaging tooling have been a mess for 2 decades. Setuptools/distutils/setuptools2, easy_install/pip, and setup.cfg/setup.py/pyproject.toml. We failed as a community on this one. It's getting better, but it's a slow process.

- the Python community is at least half composed of amateurs. It's a good thing for the dynamism of the community, but it also means the software are not very polished. Hard packaging + amateurs = packages that are releases when they reach "just good enough" stage, not one inch more. It also means you'll get things like leaking stack traces, config files in src and the likes.

So yeah, compared to Java, Python packaging and distribution sucks.

But compared to rust all packaging and distribution for all languages do, so there is that.

Re: Java Is Underhyped

#238
post #200

Speaking as a near 20 year Java programmer, Java is criminally bloated at every level. The ecosystem has been covering for its shortcomings since y2k. That ecosystem is so thick and full of abstraction that no two devs from different framework backgrounds would recognize the others code as Java. And the abstraction... it is a language for people who are more interested is the abstractions than actually getting things…

The ecosystem is large and diverse. But you don't have to use everything! You don't have to use anything ! I make a point of starting all new projects with just the JDK, and taking that as far as possible before adding dependencies. A 40k LOC codebase i work on has these external dependencies (plus some company- and vendor-specific libraries, which we would need in any language): 1. Netty, for serving HTTP 2. Glassfi…

As a java n00b, thanks for listing the libraries. Do you know any other simple libraries which will be useful generally?

Re: Java Is Underhyped

#239
I totally agree. I learned Java throughout my entire first-year at University (CompSci 2009) and it gave me such an excellent grounding in how OOP works.

I don't use it day-to-day in my work anymore, but the principles I learnt were definitely useful!

Re: Java Is Underhyped

#240
post #34
post #12

Java was heavily hyped back in the 1990s and 2000s. It's still a decent language and has a number of things to recommend it, but today we have things like Go and Rust. I think it really fell out of favor due to Oracle's litigious handling of it. As soon as Oracle bought it I remember people actually cancelling Java projects and changing languages. Another problem is how complex and verbose it got. Original late-90s J…

> I think it really fell out of favor due to Oracle's litigious handling of it. Thanks for the info. Didn’t know this. I use AdoptOpenJDK and am grateful the free version is so fully featured. I’d imagine back in the day Oracle Java reigned supreme and their licensing terms were a real concern.

Back in the day, Java came from Sun, who were generally pretty cool about it.

Oracle bought Sun in 2010, things looked okay for a year or two, then it started to get scary.

The situation now is not scary: there is a community process to manage the language and library definitions, the JDK is open source, with Oracle contributing, there are other significant contributors (notably RedHat and IBM ... so now just IBM), and there are multiple freely-available high quality binary releases of the same source.

It could potentially get scary again. If Oracle stop contributing to the open source JDK, and instead work on a closed-source version of their own, then it's not clear that there is enough developer power among the remaining contributors to keep things moving at a healthy speed. But then, if that happened, maybe users would abandon Java rather than pay Oracle, so it would be a suicidal move for Oracle. Or, if that happened, other contributors could step up contributions to hoover up customers from Oracle. But it's not entirely reassuring to be depending on game theory like this.

Post reply on HN