DEV Community

Discussion on: Java is Dead - Long Live Java

 
stealthmusic profile image
Jan Wedel

First, there are couple of talks on YouTube if you want to get into the details, e.g. youtube.com/watch?v=vbGbXUjlRyQ

Your assumption about coroutines is right. Fibers is the underlying JVM concept. A fiber is basically a data container that is able to hold stackframes (e.g. local variables) as well as pointer that knows the current location in the code. When a operation blocks, the pointer is saved and the OS thread can be used to run another Fiber until the data is available and the initial Fiber resumes the code using the pointer and the stack.

Thread Thread
 
stealthmusic profile image
Jan Wedel

Record types are basically syntactic suger. If you want to write a simple data holding class that has a couple of fields, a constructor and getters and setters, you can simply use record and you don't need to actually write all that but you can still use it.

Value types are a memory optimization in the JVM where you can actually pack all primitive types (int, String) and arrays in a sequencial order in memory without the needs of references (pointers).

Thread Thread
 
johanneslichtenberger profile image
Johannes Lichtenberger

Thanks a lot, will watch this talk now. I assume Roman and his team use some workaround / not the optimal solution to implement in Kotlin Coroutines without this JVM enhancement. But that said it'll help Kotlin as well.

I have to say Kotlin might be hyped, but almost all items from Effective Java for instance can be implemented much easier and the defaults (for instance that classes can not be extended per default are much better -- should probably be like that as it's just a few years old). Also I think Generics for instance are much better implemented/easier to use as well as the non null type hierarchy and a lot of other stuff is great. Nontheless, I still mostly (have to) write Java code in my day to day job and I hesitate to mix Java/Kotlin in one module in a multi maven module project of mine :) but I use it in one module exclusively (using Vert.x and its Coroutine based API, which I think is really great).

Thread Thread
 
stealthmusic profile image
Jan Wedel

Yeah, maybe that’s a nice way to sneak in new language to just mix them. 😉

However, if you’re working in a team in a larger code base, you will need to get a team agreement first.