Live data from Hacker News

Java is still worth learning

empatheticdeveloper.wordpress.com

61–70 of 82 posts

Re: Java is still worth learning

#61
post #48

Earlier quoted context omitted.

> Solving problems became more about handling the language than understanding the logic. I've worked with Java for 25 years and have a love/hate relationship. Java garbage collection is both great, and terrible. Sometimes objects are instantiated in a method, and should be marked for GC when you leave the method but aren't. There isn't logic or reason, and it trips up juniors hard and reworking "new" features like st…

> Java garbage collection is both great, and terrible. Sometimes objects are instantiated in a method, and should be marked for GC when you leave the method but aren't. In the last decade of writing Java software I didn't ever come across a genuine GC bug where a unreferenced object wasn't collected. I'm not disputing that they exist, but if you regularly hit such "bugs" I'm wondering if your understanding of Java GC…

No its not regularly, I think just once in at least 10 years, probably longer. And it could easily be either a Spring bug, or bad configuration through misunderstanding.

My point was more that it can be opaque when it doesn't act as expected. Sometimes heap inspection is helpful, but if you use Kafka or Spring Data, etc, it can easily just appear to be a char or int array.

Re: Java is still worth learning

#62

Earlier quoted context omitted.

> Solving problems became more about handling the language than understanding the logic. I've worked with Java for 25 years and have a love/hate relationship. Java garbage collection is both great, and terrible. Sometimes objects are instantiated in a method, and should be marked for GC when you leave the method but aren't. There isn't logic or reason, and it trips up juniors hard and reworking "new" features like st…

> Sometimes objects are instantiated in a method, and should be marked for GC when you leave the method but aren't. Can you give more details, and/or an example?

Apart from the comment of happymellon (blaming Spring for doing things behind your back), it happens that a factory , building objects for you , will have a “bug” and retain a reference to them for whatever reason. That is sometimes tricky to figure out. Nothing Java can be blamed for, as these kind of tricks can happen in any language. ([newbie at C but] I suppose in C, the consumer of the object can force its deallocation, which may lead to other nasty side effect]

Re: Java is still worth learning

#63
post #62

Earlier quoted context omitted.

> Sometimes objects are instantiated in a method, and should be marked for GC when you leave the method but aren't. Can you give more details, and/or an example?

Apart from the comment of happymellon (blaming Spring for doing things behind your back), it happens that a factory , building objects for you , will have a “bug” and retain a reference to them for whatever reason. That is sometimes tricky to figure out. Nothing Java can be blamed for, as these kind of tricks can happen in any language. ([newbie at C but] I suppose in C, the consumer of the object can force its deall…

> I've worked with Java for 25 years and have a love/hate relationship.

> Java garbage collection is both great, and terrible.

> Nothing Java can be blamed for

I mean, it's not like we're discussing Java or anything. So they hate java because of something that can happen in any language?

Re: Java is still worth learning

#64
Java is the new Cobol.

Java had changing its skin: Applets and Security managers, part of the cornerstone of Java 1.102 are gone. So Java are 2-3 different evolving language nowadays.

JVM has so strong optimization layers which make very difficult for other languages to provide similar performance (Erlang is one of them in my humble opinion).

Yeah C/C++ program are faster but error prone (manual memory allocation...) PHP is faster for web developing but refactoring is a nightmare. Python can compete, but I do see few big projects written in it (Zulip,Dropbox,Plone/Zope).

JavaScript is super rapid dev rapid but can become a mess.

Rust is the newcome, I do not know but it seems quite cognitive-complex to code with it (I may be wrong).

I worked with shit-like Java code and i was always able to refactor it in small chunks.

The verbosity of Java is its major strength, but some things added to the language (like default interface implementations, virtual threads) are drawbacks because it create some confusion on basic pattern strategy you can employ with the language.

Re: Java is still worth learning

#65
post #48

Earlier quoted context omitted.

> Java garbage collection is both great, and terrible. Sometimes objects are instantiated in a method, and should be marked for GC when you leave the method but aren't. In the last decade of writing Java software I didn't ever come across a genuine GC bug where a unreferenced object wasn't collected. I'm not disputing that they exist, but if you regularly hit such "bugs" I'm wondering if your understanding of Java GC…

No its not regularly, I think just once in at least 10 years, probably longer. And it could easily be either a Spring bug, or bad configuration through misunderstanding. My point was more that it can be opaque when it doesn't act as expected. Sometimes heap inspection is helpful, but if you use Kafka or Spring Data, etc, it can easily just appear to be a char or int array.

So you hit this bug about one and a half times in your entire career, you're not sure Java caused it or even if it was really a bug, but due to it you have a love/hate relationship and garbage collection is terrible?

Re: Java is still worth learning

#66

If Java can be compiled into a single binary and have a package manager then I would learn it. I really want to like Java, or JVM-based languages specifically, but its extremely annoying and complicated to figure out how and why thing works.

Like for about 25 years now, small sample (there are others),

https://en.wikipedia.org/wiki/Excelsior_JET

https://en.wikipedia.org/wiki/GNU_Compiler_for_Java

https://www.aicas.com/products-services/jamaicavm/

https://www.ptc.com/en/products/developer-tools/perc

The difference being that those projects required $$$$ that only big corps were willing to shell out.

Now you get free beer via GraalVM (evolution from MaximeVM efforts at Sun Labs), and OpenJ9, IBM's AOT compiler that traces back to Maestro realtime JVM for embedded development.

So complaining about $$$$ in AOT toolchains is no longer a reason.

Then we have the Android cousin that does a mix of JIT and AOT since Android 7.

Re: Java is still worth learning

#67

Java is the new Cobol. Java had changing its skin: Applets and Security managers, part of the cornerstone of Java 1.102 are gone. So Java are 2-3 different evolving language nowadays. JVM has so strong optimization layers which make very difficult for other languages to provide similar performance (Erlang is one of them in my humble opinion). Yeah C/C++ program are faster but error prone (manual memory allocation...)…

Only ART, .NET, Erlang, and V8 are on part, with similar engineering efforts.

Which when coupled with the great IDE tooling, graphical debuggers and libraries, is the reason why with exception of Erlang, they remain my main tools.

With the occasional dip into C++ for native libraries.

Re: Java is still worth learning

#68

Advocating that people use either Quarkus or Spring is like advocating they build their stuff in COBOL. Java is an alright language by itself, but the "EE" frameworks and the ecosystem that surrounds them are corrosive to good software. You are actively harming your brain by learning JavaEE. If you do that to new developers you deserve to have your beans turn undiscoverable on Christmas Eve.

What is corrosive is the enterprise attitude of arquitecture astronauts, and that you will get regardless of the language.

I have been dealing with "EE" frameworks since C was the main enterprise language, or even xBASE.

Because OOP hype frameworks, we had Yourdon Systems Method and nice overblown frameworks written in C, with OS IPC all over the place, aka microservices.

Re: Java is still worth learning

#69
post #62

Earlier quoted context omitted.

Apart from the comment of happymellon (blaming Spring for doing things behind your back), it happens that a factory , building objects for you , will have a “bug” and retain a reference to them for whatever reason. That is sometimes tricky to figure out. Nothing Java can be blamed for, as these kind of tricks can happen in any language. ([newbie at C but] I suppose in C, the consumer of the object can force its deall…

> I've worked with Java for 25 years and have a love/hate relationship. > Java garbage collection is both great, and terrible. > Nothing Java can be blamed for I mean, it's not like we're discussing Java or anything. So they hate java because of something that can happen in any language?

They expected not to have to deal with memory at all, I presume ;)

[to go a bit off topic, the debugging of those issues is reasonably tool-assisted in Java, whereas I honestly don’t know how to solve them in, let’s say, Javascript/TS).

Re: Java is still worth learning

#70
Not only it is one of the best ecosystems, Java bashers keep forgetting that it has a cousin ruling 80% of the world market in mobile phones, via the Java subset it supports, and the whole JVM infrastructure Gradle, Kotlin and Android Studio rely on.
Post reply on HN