3 ms·
What this article doesn't mention is that not only can you replace Java with Kotlin, you can replace JavaScript too. I've even gotten rid of ugly bash scripts w
by Felz 8y ago
What this article doesn't mention is that not only can you replace Java with Kotlin, you can replace JavaScript too. I've even gotten rid of ugly bash scripts with judicious application of kscript. And soon, Gradle scripts too. (Good riddance, Groovy.)
But compile-to-JVM is compelling enough on its own. The Java ecosystem that comes for free with Kotlin gives you an incredible amount of power. A massive collection of battle-tested libraries, the excellent performance of the JVM, and tooling. Beautiful, productive tooling.
- bsaul 8y agoI’m wondering about diving into the jvm ecosystem. Could you give some examples of the beautiful productive tooling you love ?
- insertnickname 8y agoIntelliJ IDEA is wonderful (and a bit, if not unreasonably, slow).
- repolfx 8y agoMost obviously IntelliJ itself. I read a lot of praise for Visual Studio Code these days and then when people describe what they're so in love with it for, they're describing basic features IntelliJ had years ago. It's quite clear a lot of VSCode users have come from Atom or Sublime or just console text editors and have never really encountered a proper IDE before. VisualVM is very helpful. You can attach to any running Java program on your system and get graphs of CPU, memory usage with garbage collection information, you can take a snapshot of what every thread is doing with reliable stack traces, you can take a heap dump and then query it with the "Object Graph Query Language" or visualise it with tables and charts to understand where your memory is being used. You can do deep CPU profiling or lightweight CPU sampling. It understands mixed language programs and can show you the heap and stack in ways that make sense for not just Java and Kotlin but Ruby, JavaScript, etc. https://visualvm.github.io/graal.html https://visualvm.github.io/graal.html Of course all these features work transparently over the network too. Then there's Mission Control. It's a profiling system so fast and low overhead you're intended to keep it running all the time even in production. You can connect it to a live server and profile without disturbing users. Then there are ultra-low-pause garbage collectors like ZGC, Shenandoah. Whilst Golang offers such a thing too, it comes with the major caveat that it has a very simplistic design that creates enormous CPU and memory overheads. The Java ultra-low-pause time GCs have more sophisticated designs that impose much lower overheads on running applications. Then there's SubstrateVM, which can turn Java programs into standalone native executables of small size, without any JVM dependency. This comes with some caveats: execution speed is slower and you can't do dynamic classloading, which quite a few advanced frameworks do require. You also have to tell it in config files what you want to reflect, so it doesn't throw away code accessed only reflectively. Also the garbage collector is fairly middle of the road and not so sophisticated as what you get in HotSpot. After all the regular JVM is large because it's giving you a lot of stuff. But it can be very useful for command line tools. Talking of which, check out the combination of PicoCLI, Apache SSHD and JLine. They integrate together well to enable you to easily and rapidly create interactive shells for your program, accessible via SSH. There are of course many other powerful libraries available. Finally you may like to explore things like the Chronon time-travelling debugger, which records what your app does so you can step forwards and backwards through a debugging session.