DEV Community

Discussion on: Writing unit tests with React, Typescript, and react-testing-library

 
leob profile image
leob

I guess because Java doesn't have a static linker? With C++ everything is statically linked at build time, not so with Java, linking/loading is dynamic.

Thread Thread
 
pclundaahl profile image
Patrick Charles-Lundaahl

Right... I suppose back when Java was in its inception, long-running, stateful servers, were the only game in town, hey?

I don't know exactly where I got this, but I sort of feel like so much of the promise of the JVM was in its ability to load new code at runtime. I'm not sure if that's true, but I think I can understand the appeal - particularly for embedded devices and the like. I don't know, does that sound sort of accurate?

By the way, I wanted to say thanks for the chat over the last few days! It's been really cool to hear your perspective on things.

Thread Thread
 
leob profile image
leob • Edited

You're welcome, absolutely interesting to talk about Java!

I'm amazed to see how much innovation there's still going on in the Java space, all the time they're inventing new GC's (garbage collectors), VM's and so on. Recently I heard about "GraalVM" which is apparently a big deal, and just now I came across this:

quarkus.io/

Never heard about it but it looks powerful, a "cloud native" Kubernetes-ready non-blocking reactive GraalVM based super Java which supposedly blows all the others out of the water. Amazing, goes to show how far you can take Java and especially the Java VM architecture.

I don't know about those long-running servers, but I do think that "dynamic linking" is an intrinsic part of the Java VM architecture. Just look at class loaders, that's a huge (and hugely confusing) topic in Java land, together with garbage collectors, and I guess it wouldn't work with static linking.

On the other hand (I am not completely sure about this but it seems so) I think that Android apps (which can also be built with Java) do use static linking. But, Java apps on Android aren't compiled to Java JVM bytecodes and don't run under the JVM, it's all handled by the 'Dalvik' VM so it's a totally different architecture, only the syntax (Java) looks the same but under he hood it's something else.

Thread Thread
 
pclundaahl profile image
Patrick Charles-Lundaahl

I've heard of GraalVM! It sounds really promising. Quarkus sounds pretty cool, too - 0.008s to launch a Java app is pretty damned good, even if it's just Hello World.

Also, wow - I never realized Android used a totally different VM. That's really cool.