DEV Community

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

 
leob profile image
leob

OSGi ouch, that's also a beast ... never used it, but what I heard about it didn't make me eager to use it. Eclipse is built on OSGi.

But why don't you try the new Java module system (Jigsaw) instead of OSGi? The lead dev at my Java client uses it and apparently with reasonable success. I think it's much simpler and easier to use than OSGi.

As I said, I think Java can be a joy to use, the more "legacy" and enterprise baggage you can shed and the more 'lightweight' and modern you can make it the better.

For instance, get rid of classical "containers" or application servers and just run your application as a standalone "app" with the webserver embedded, that removes a ton of annoyance. Spring Boot simplifies a lot of things in that regard.

And if you can use the newest Java versions with their goodies (closures and map/filter/reduce and all that), that also makes a big difference.

Thread Thread
 
pclundaahl profile image
Patrick Charles-Lundaahl

That's a good question. I guess we're probably still using OSGi because we don't have the resources to justify the lift (competitive, rapidly changing market; big code base, etc.).

Jigsaw looks really nice, though. I've always wondered why it was preferable to make missing dependencies a runtime exception rather than fail on compilation.

Thread Thread
 
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.