6 ms·
What are the benefits of Kotlin over Java? Something I wish they went into!
by freeqaz 2y ago
What are the benefits of Kotlin over Java? Something I wish they went into!
- cute_boi 2y ago> maximize our gains in developer productivity and null safety Java is to too verbose. Kotlin have features like null safety, better functional programming, better coroutines, advanced sealed classe. Java virtual threads is still not ready and development was very slow. Blame oracle for being too complacent.
- t-writescode 2y agoI commented here: https://news.ycombinator.com/item?id=42483538 https://news.ycombinator.com/item?id=42483538 Mostly, I find it far less verbose with a couple huge convenience features that I'm constantly using and would feel very lost without; and, they all come as part of the language, rather than bytecode hacks / pre-processors, like lombak
- smrtinsert 2y agoLombok is absolutely painless.
- t-writescode 2y agoI admit I have no direct experience with it. For my perspective on it, I rely on one of the best developers I've ever worked with - especially when it comes to debugging and deep investigation and she *hates* it. If I had to assume (we don't work together anymore), it's because it did some freaky stuff that made debugging the weird bugs really, really hard.
- throwaway8546 2y agoI have been using Lombok for many years and haven't experienced any issues. Admittedly most of my work involves standard Spring Boot services, so perhaps your friend works with some low level projects that behave differently. In my experience I don't hesitate to recommend Lombok. It will generate getters/setter/builders/toString in a transparent way, without visible changes in the code. This keeps Java classes much more concise to read. It also provides withers on records, while waiting for native support (it's coming)
- aembleton 2y agoLombok does provide a lot but it doesn't make types non nullable by default or reduce verbosity or give us extension functions.
- wiseowise 2y agoLombok is absolute garbage. Either use proper Java 2.0 like Scala/Kotlin or stay in Java.
- LinXitoW 2y agoMy biggest pet peeve with Kotlin is that they got rid of checked exceptions and replaced them with nothing at all. All error code flow is now just invisible unchecked exceptions, the single worst kind of error handling imaginable. I know they added the Result type later on, but there's zero convenience to it, so you have to manually handle every error, even if you just want to bubble it. Checked Exceptions were better, though Rust still has the best error handling in any non-functional language.
- bberrry 2y agoDepends on what you're writing I guess (as always). I write backend services and if there is an exception thrown, generally the whole request is forfeit. So a top-level exception handler is all that's needed.. no checked exceptions ruining my lambdas or streams like in Java.
- t-writescode 2y agoNot to mention a top-level exception system is a great place to put the db transaction rollback so everything’s always undone (some exceptions apply)
- TheSociologist 2y agoSteve Yegge has a fun article on why someone might prefer kotlin over Java: http://steve-yegge.blogspot.com/2017/05/why-kotlin-is-better-than-whatever-dumb.html?m=1 http://steve-yegge.blogspot.com/2017/05/why-kotlin-is-better... Do note that Java has quite a few features now that it didn’t at the time of writing.
- billisonline 2y ago“More specifically, from JetBrains, the makers of the world-famous IntelliJ IDEA IDE, whose primary claim to fame is its lovely orange, green, purple and black 'Darcula' theme” This must be a bad attempt at a joke, right? Darcula is a nice theme (I personally prefer high contrast), but surely IntelliJ’s code inspection and automatic refactoring have always been its claim to fame.
- sitkack 2y agoThemes are the cup holders of the IDE world. You can't sell one without them.
- TheSociologist 2y agoYegge’s writing has a pretty sardonic sense of humor. I like it but I’ve seen it put off some folk.